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 <[email protected] <javascript:>> 
> wrote:
>
> First of all - thanks for mod_wsgi express!
>
> This <http://blog.dscpl.com.au/2015/04/introducing-modwsgi-express.html> 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 know *

>
>
> 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?
>

*I used: mod_wsgi-express start-server wsgi.py *

>
> 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.
>
 
*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.py

running 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 it
>
> I 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:
>
>     
> http://blog.dscpl.com.au/2015/04/using-modwsgi-express-with-django.html
>     
> http://blog.dscpl.com.au/2015/04/integrating-modwsgi-express-as-django.html
>
> Also worthwhile reading:
>
>     
> http://blog.dscpl.com.au/2015/05/using-modwsgi-express-as-development.html
>
> 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.py

>
> Graham
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to