Re: ImproperlyConfigured: Error importing middleware django.contrib.sessions.middleware: "No module named mysite"
On Feb 3, 12:12 am, "HenrikG" <[EMAIL PROTECTED]> wrote: > My biggest problem was to get the Location directive right in the > httpd.conf. It now looks like this: > > > SetHandlermod_python > PythonHandler django.core.handlers.modpython > PythonPath "sys.path + ['/usr/local/apache2/django']" > SetEnv DJANGO_SETTINGS_MODULE myproject.settings > PythonDebug On > PythonAutoReload On > > > OK, maybe that path isn't the smartest, but I'm a Linux noob and I'm > learning. The "PythonAutoReload On" means thatmod_pythonreloads all > python modules automatically whenever they change. This is on by > default, I read somewhere, but I figured it wouldn't hurt. FYI, the mod_python PythonAutoReload does not cause all modules that change to be reloaded, it only reloads certain modules. Candidates for reloading are only those which are referenced directly by the Python*Handler directives, and generally only those of them which are in the Apache document tree. When Django is used the directive basically doesn't do anything as the top level module is the mod_python handler which isn't going to change. Thus, when using Django, you may as well just turn PythonAutoReload to Off as it isn't going to ever do anything or help in anyway when changes are made to your Django application. 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ImproperlyConfigured: Error importing middleware django.contrib.sessions.middleware: "No module named mysite"
Hi John! I also started my Django-work on WinXP, but I used the built-in Django webbserver and I never had any "no module"-errors. I'm now using Ubuntu-Apache-modpython-PostgreSQL and when I started in Ubuntu, I had some of those errors. My solution was (except for recreating a corrupt database) putting the right stuff in the Location-directive in Apache-config and making sure the right user was running the Apache-server and owned the Django- files. I'm not sure if this helps you, but you can add this in Apache conf to set which user owns the Apache server thread: . User postgres Group postgres So, in my case, the user is called 'postgres'. On the django project directory, to make sure the apache thread could read the django files, I did this, being root: chown -R postgres . Explanation: -R = recursive . = files in current folder postgres = new owner to the files My biggest problem was to get the Location directive right in the httpd.conf. It now looks like this: SetHandler mod_python PythonHandler django.core.handlers.modpython PythonPath "sys.path + ['/usr/local/apache2/django']" SetEnv DJANGO_SETTINGS_MODULE myproject.settings PythonDebug On PythonAutoReload On OK, maybe that path isn't the smartest, but I'm a Linux noob and I'm learning. The "PythonAutoReload On" means that mod_python reloads all python modules automatically whenever they change. This is on by default, I read somewhere, but I figured it wouldn't hurt. To make apache update better, you could set this somewhere in httpd.conf: MaxRequestPerChild 1 I hope this helps. /Henrik --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ImproperlyConfigured: Error importing middleware django.contrib.sessions.middleware: "No module named mysite"
Henrik, I've been stuck in a a place like Ron's all morning. I thought I had gotten to a later problem when I started getting Django errors indication that there was 'no module mysite.urls', but I just gave it another try, and I'm back to the mod-python error 'no module named mysite'. I seem to be at a point where I get to choose between the mod-python and Django errors about non-existence of modules. At least I no longer have Apache 'no such place' errors. Do you know why there is such a lag in response to configuration file changes? When I change httpd.conf and restart Apache, it seems to see new settings fairly quickly, but when I change settings.py, Django does not "catch up" for quite a while. I tried deleting everything I could find with a .pyc extension, but that does not seem to help, (and may be causing some actual harm?) I have gotten the full tutorial to work (WinXP, Python 2.4.1/mod- python3.2.8 /Django 0.95) with the development web server, and the next place to go is Apache (2.0.59, at least for now). I intend to move to Linux, but for reasons of practicality I am currently working in Windows. Thanks for any light you can shed on this. John. On Feb 1, 7:09 am, "HenrikG" <[EMAIL PROTECTED]> wrote: > Hi Ron! > > Try changing > '/home/rsie/projects/mysite' > to > '/home/rsie/projects' > > and also change > SetEnv DJANGO_SETTINGS_MODULE settings > to > SetEnv DJANGO_SETTINGS_MODULE mysite.settings > > regards, > /Henrik --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ImproperlyConfigured: Error importing middleware django.contrib.sessions.middleware: "No module named mysite"
Hi Ron! Try changing '/home/rsie/projects/mysite' to '/home/rsie/projects' and also change SetEnv DJANGO_SETTINGS_MODULE settings to SetEnv DJANGO_SETTINGS_MODULE mysite.settings regards, /Henrik --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
ImproperlyConfigured: Error importing middleware django.contrib.sessions.middleware: "No module named mysite"
Hi, I am attempting to switch to apache+mod_python, but running into the error above. /*environment*/ fedora 5 apache 2.2 python 2.4 django 0.95 /*project location*/ /home/rsie/projects/mysite /*server root*/ /var/www/html /*Django install location*/ /home/distributions/Django-0.95 /*httpd.conf*/ SetHandler python-program PythonPath "['/home/rsie/projects/mysite','/home/distributions/Django-0.95/django/contrib/sessions/'] + sys.path" PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE settings PythonDebug On I've searched other posts but they don't seem to be having the same problem. I've created a link in the server root to point to my project location. I've also tested mod_python with the "mptest.py" handler and that works fine. I've gone into the interpreter and printed out sys.path and found that /usr/lib/python/site-packages/Django-0.95 is in the path. I don't understand why it's looking for a module called mysite when looking for something under the django dist. Can anybody help? thanks in advance, Ron --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---