Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Jan. 26, 2011 21:59:48

R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

custom Middleware for Django


I'm new to Django and trying to place a custom middleware file in the
Django path. I'm modifying the settings.py file in my project. The
swfupload.py is located in django

/usr/lib/python2.4/site-packages/django/middleware

I had it in the project earlier but ti did not work and this does not
work either.


MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
# 'django.middleware.swfupload.SWFUploadMiddleware',
}

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Jan. 26, 2011 22:16:00

Piotr K.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

custom Middleware for Django


Hi,

More a Python thing, than Django.

You should never put custom code in the django package.

Generally you can put SWFUploadMiddleware inside, say, middleware.py in the
same directory as your settings.py.

Then you'd have to put:
'yourprojectname.middleware.SWFUploadMiddleware'

Once you understand how namespaces work, you'll be fine. At least until you
try do deploy using mod_wsgi ;)


Regards,
Piotr

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Jan. 27, 2011 09:44:29

Graham D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

custom Middleware for Django


On Thursday, January 27, 2011 9:15:52 AM UTC+11, 3lancer.eu wrote:
>
> Hi,
>
> More a Python thing, than Django.
>
> You should never put custom code in the django package.
>
> Generally you can put SWFUploadMiddleware inside, say, middleware.py in the
> same directory as your settings.py.
>
> Then you'd have to put:
> 'yourprojectname.middleware.SWFUploadMiddleware'
>
> Once you understand how namespaces work, you'll be fine. At least until you
> try do deploy using mod_wsgi ;)
>

That isn't exactly mod_wsgi's fault. You should go have a read of:http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.htmlsome time and then you might understand the horrible things that the
development server does with paths.

:-)

Graham

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 Jan. 27, 2011 11:45:38

Piotr K.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

custom Middleware for Django


>
> That isn't exactly mod_wsgi's fault. You should go have a read of:
>
>http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html>
> some time and then you might understand the horrible things that the
> development server does with paths.
>
> :-)
>

Yes, I didn't state it's mod_wsgi's fault and I'm a big fan of your script.

I just recall my disappointment when I deployed Django for the first time
and... doh! 500! But it all worked!

Regards,
Piotr

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#5 Jan. 27, 2011 14:36:47

R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

custom Middleware for Django


Thanks! guys for all the help

regard,
Richard

On Jan 27, 6:45 am, Piotr Kilczuk <kilc...@gmail.com> wrote:
> > That isn't exactly mod_wsgi's fault. You should go have a read of:
>
> >http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html>
> > some time and then you might understand the horrible things that the
> > development server does with paths.
>
> > :-)
>
> Yes, I didn't state it's mod_wsgi's fault and I'm a big fan of your script.
>
> I just recall my disappointment when I deployed Django for the first time
> and... doh! 500! But it all worked!
>
> Regards,
> Piotr

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 15th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support