On 1 Jul 2017, at 4:17 PM, Anupam Jain <anupa...@gmail.com> wrote:First of all - thanks for mod_wsgi express!
This post says "As to the configuration of Apache, there actually wasn't any."
Is it ok to assume that I dont need to do any configuration on Apache at all (as in nothing in conf-enabled/available and sites-enabled/available)? (That sounds to be too good to be true so thought to check)
I have setup everything for mod_wsgi express and getting the error "ImportError: No module named '(projectname)'"
This is not the one caused by circular imports but something to do with setting the path somewhere I think (as I learnt from some SO posts) but not entirely clear about itI did setup a django.conf in Apache's conf-enabled, so I am suspecting that may be conflicting with something.
On 1 Jul 2017, at 4:17 PM, Anupam Jain <anupa...@gmail.com> wrote:First of all - thanks for mod_wsgi express!
This post says "As to the configuration of Apache, there actually wasn't any."
Is it ok to assume that I dont need to do any configuration on Apache at all (as in nothing in conf-enabled/available and sites-enabled/available)? (That sounds to be too good to be true so thought to check)Do not touch any system Apache configuration files under /etc/apache2, /etc/httpd or whatever directory it is that your operating systems puts the Apache configuration. When you use mod_wsgi-express it completely ignores them, does not modify them, nor use them in any way.
I have setup everything for mod_wsgi express and getting the error "ImportError: No module named '(projectname)'"What command did you run and what arguments to mod_wsgi-express?
If you get an error with that exact message, then it indicates you copied some template for something from somewhere where you were expected to replace '(projectname)' with a different value for your project. Did you do that? Or is this not actually the error message you go.
When you run mod_wsgi-express the directory you run mod_wsgi-express in should be added to the Python module search path, so as long as any modules can be imported from that location you should be good. If that shouldn't be the base directory for imports of your projects, you can use --working-directory option to override it, or use the --python-path option to specify additional directories to search for modules.So what is the directory layout for your project, which directory are you running mod_wsgi-express from and with what arguments.
This is not the one caused by circular imports but something to do with setting the path somewhere I think (as I learnt from some SO posts) but not entirely clear about itI did setup a django.conf in Apache's conf-enabled, so I am suspecting that may be conflicting with something.It shouldn't as it will be ignored.If you are using Django, you should perhaps look at:Also worthwhile reading:Note that if you have inherited an old Django code base which hasn't been updated correctly so the settings module includes settings defined in newer Django versions, and you have restructured your application code so the settings module is now at a different directory level, and you are using the method of integrating mod_wsgi-express into Django itself, you may also have issues with the settings module not being found when being imported.So also indicate what version of Django your project code was originally created using.
Graham
On 1 Jul 2017, at 5:52 PM, Anupam Jain <anupa...@gmail.com> wrote:Answers inline, thanks
On Saturday, July 1, 2017 at 1:02:07 PM UTC+5:30, Graham Dumpleton wrote:On 1 Jul 2017, at 4:17 PM, Anupam Jain <anupa...@gmail.com> wrote:First of all - thanks for mod_wsgi express!
This post says "As to the configuration of Apache, there actually wasn't any."
Is it ok to assume that I dont need to do any configuration on Apache at all (as in nothing in conf-enabled/available and sites-enabled/available)? (That sounds to be too good to be true so thought to check)Do not touch any system Apache configuration files under /etc/apache2, /etc/httpd or whatever directory it is that your operating systems puts the Apache configuration. When you use mod_wsgi-express it completely ignores them, does not modify them, nor use them in any way.Thats great to knowI have setup everything for mod_wsgi express and getting the error "ImportError: No module named '(projectname)'"What command did you run and what arguments to mod_wsgi-express?I used: mod_wsgi-express start-server wsgi.pyIf you get an error with that exact message, then it indicates you copied some template for something from somewhere where you were expected to replace '(projectname)' with a different value for your project. Did you do that? Or is this not actually the error message you go.Thats not the exact message. I meant that its searching for the high level directory with the Django project name (directory structure below)When you run mod_wsgi-express the directory you run mod_wsgi-express in should be added to the Python module search path, so as long as any modules can be imported from that location you should be good. If that shouldn't be the base directory for imports of your projects, you can use --working-directory option to override it, or use the --python-path option to specify additional directories to search for modules.So what is the directory layout for your project, which directory are you running mod_wsgi-express from and with what arguments.
directory is something like this
projectname- appname- views.py- other files- projectname- wsgi.pyrunning mod_wsgi-express from /home/username/projectname/projectname
This is not the one caused by circular imports but something to do with setting the path somewhere I think (as I learnt from some SO posts) but not entirely clear about itI did setup a django.conf in Apache's conf-enabled, so I am suspecting that may be conflicting with something.It shouldn't as it will be ignored.If you are using Django, you should perhaps look at:Also worthwhile reading:Note that if you have inherited an old Django code base which hasn't been updated correctly so the settings module includes settings defined in newer Django versions, and you have restructured your application code so the settings module is now at a different directory level, and you are using the method of integrating mod_wsgi-express into Django itself, you may also have issues with the settings module not being found when being imported.So also indicate what version of Django your project code was originally created using.The project was created on Django 1.10.2 and I am now moving it from dev to prod (GCP, Debian). Installed the same Django version on prod as well. I'll read the above Django posts as well but yes, I did create a settings directory under projectname/projectname which includes different versions of settings for dev and prod. I have set the environment variable for settings in the virtualenv's activate script. Also, os.environ.setdefault() is changed accordingly in wsgi.pyGraham
--
You received this message because you are subscribed to the Google Groups "modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.
To post to this group, send email to mod...@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.
Server URL : http://localhost:8000/
Server Root : /tmp/mod_wsgi-localhost:8000:1001
Server Conf : /tmp/mod_wsgi-localhost:8000:1001/httpd.conf
Error Log File : /tmp/mod_wsgi-localhost:8000:1001/error_log (warn)
Request Capacity : 5 (1 process * 5 threads)
Request Timeout : 60 (seconds)
Startup Timeout : 15 (seconds)
Queue Backlog : 100 (connections)
Queue Timeout : 45 (seconds)
Server Capacity : 20 (event/worker), 20 (prefork)
Server Backlog : 500 (connections)
Locale Setting : en_US.UTF-8
I am using localhost:8000 to access the site. Will turn on the logging option to see the logs on the console. I have been seeing them from /tmp/mod_wsgi-localhost:8000:1001/error_log so far.
ImportError: No module named 'wsgi'
Directory Structure:
mysite
- myapp
- views.py
- other files
- mysite
- wsgi.py
- __init__.py
settings
- __init__.py
- base.py
- production.py
- development.py
Running the following command from: home/username/mysite/
mod_wsgi-express start-server wsgi.py --application-type module mysite.wsgi --log-to-terminal
wsgi.py:
import os
# import sys
from django.core.wsgi import get_wsgi_application
# sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")))
# sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../")))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings.production")
application = get_wsgi_application()
--
You received this message because you are subscribed to a topic in the Google Groups "modwsgi" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/modwsgi/_nUEp1WiRH4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to modwsgi+unsubscribe@googlegroups.com.
To post to this group, send email to mod...@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.
[Sat Jul 01 08:48:59.384492 2017] [wsgi:error] [pid 15499:tid 139843043293056] mod_wsgi (pid=15499): Target WSGI script '/tmp/mod_wsgi-localhost:8000:1001/handler.wsgi' cannot be loaded as Python module.[Sat Jul 01 08:48:59.384622 2017] [wsgi:error] [pid 15499:tid 139843043293056] mod_wsgi (pid=15499): Exception occurred processing WSGI script '/tmp/mod_wsgi-localhost:8000:1001/handler.wsgi'.[Sat Jul 01 08:48:59.384677 2017] [wsgi:error] [pid 15499:tid 139843043293056] Traceback (most recent call last):[Sat Jul 01 08:48:59.384855 2017] [wsgi:error] [pid 15499:tid 139843043293056] File "/tmp/mod_wsgi-localhost:8000:1001/handler.wsgi", line 94, in <module>[Sat Jul 01 08:48:59.384888 2017] [wsgi:error] [pid 15499:tid 139843043293056] recorder_directory=recorder_directory)[Sat Jul 01 08:48:59.385446 2017] [wsgi:error] [pid 15499:tid 139843043293056] File "/home/anupam/ENV/lib/python3.4/site-packages/mod_wsgi/server/__init__.py", line 1374, in __init__[Sat Jul 01 08:48:59.385483 2017] [wsgi:error] [pid 15499:tid 139843043293056] __import__(entry_point)
[Sat Jul 01 08:48:59.385523 2017] [wsgi:error] [pid 15499:tid 139843043293056] ImportError: No module named 'wsgi'
Graham
To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+unsubscribe@googlegroups.com.
To post to this group, send email to mod...@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "modwsgi" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/modwsgi/_nUEp1WiRH4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to modwsgi+unsubscribe@googlegroups.com.
To post to this group, send email to mod...@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.