WebFaction
Community site: login faq
0
1

I have configured my httpd.conf with the lines:

WSGIDaemonProcess ralph processes=2 threads=12 python-path=/hame/nimasmi/webapps/ralph:/home/nimasmi/webapps/ralph/ralph:/home/nimasmi/webapps/ralph/lib/python2.7
...
WSGIScriptAlias / /home/nimasmi/webapps/ralph/myproject.wsgi

I have also got the following in /home/nimasmi/webapps/ralph/myproject.wsgi:

os.environ['DJANGO_SETTINGS_MODULE'] = 'ralph.settings'

and I get the following in /home/nimasmi/logs/user/error_ralph.log:

    raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'ralph.settings' (Is it on sys.path?): No module named ralph.settings

I've tried all this with sys.path.append('/home/nimasmi/webapps/ralph/ralph') and variations thereof, as suggested on stackoverflow, in the docs and on this community, but the exact same error message occurs. However I was led to believe by the google docs for WSGIDaemonProcess that the python-path=/ option is equivalent to adding to the sys.path anyway.

Where am I going wrong?

Disclaimer: I have opened a ticket also, but wondered whether the Q&A community might be quicker.

asked 27 Jun '12, 15:29

nimasmi
112
accept rate: 0%

edited 27 Jun '12, 15:30


'ralph' exists in '/hame/nimasmi/webapps/' and that is not specifically listed in the path info, change it to this,

WSGIDaemonProcess ralph processes=2 threads=12 python-path=/home/nimasmi/webapps/ralph:/home/nimasmi/webapps/ralph/ralph:/home/nimasmi/webapps/ralph/lib/python2.7:/home/nimasmi/webapps/
permanent link

answered 27 Jun '12, 18:47

johns
5.4k412
accept rate: 23%

edited 28 Jun '12, 01:58

ryans ♦♦
5.0k103960

I changed it to:

WSGIDaemonProcess ralph processes=2 threads=12 python-path=/home/nimasmi/webapps/ralph:/home/nimasmi/webapps/ralph/ralph:/home/nimasmi/webapps/ralph/lib/python2.7:/home/nimasmi/webapps

Same error.

The full path to my myproject.wsgi is /home/nimasmi/webapps/ralph/myproject.wsgi, so I would have thought that pointing it to the /ralph directory would have been enough.

(28 Jun '12, 01:53) nimasmi

Since your WSGI file contains os.environ['DJANGO_SETTINGS_MODULE'] = 'ralph.settings', you need to add the parent directory of the one containing settings.py to your Python search path.

If you still cannot figure it out, please open a support ticket, so we can take a look at it for you.

(28 Jun '12, 02:27) todork

The full paths of my files are:

/home/nimasmi/webapps/ralph/myproject.wsgi
/home/nimasmi/webapps/ralph/ralph/settings.py

It looks to me like my WSGIDaemonProcess settings encompass those paths. The 'parent directory of the one containing settings.py' is /home/nimasmi/webapps/ralph I think, so that is in the python-path setting.

I have replied to this effect on the original ticket.

(28 Jun '12, 06:03) nimasmi

Hi,

As we discussed in the support ticket, the problem was that you had no init.py file in the "ralph" directory, so it wasn't recognized as a Python module.

(28 Jun '12, 10:44) todork

I found myself in a similar situation. Rather than trying to get settings to work in the project subfolder, I moved settings up a directory to the project parent directory.

permanent link

answered 03 Mar '13, 18:11

nate
1
accept rate: 0%

Exactly the same problem and banging my head against the wall.

__init__.py is present in both directories. Moving the settings up (or wsgi.py up) has no appreciable effect.

httpd.conf:

 [...]
WSGIDaemonProcess mezzanine processes=2 threads=12 python-path=/home/halavais/webapps/mezzanine:/home/halavais/webapps/mezzanine/sparky:/home/halavais/webapps/mezzanine/sparky/sparky:/home/halavais/webapps/mezzanine/lib/python3.5
WSGIProcessGroup mezzanine
WSGIRestrictEmbedded On
WSGILazyInitialization On
WSGIScriptAlias / /home/halavais/webapps/mezzanine/sparky/sparky/wsgi.py

The wsgi.py is--as suggested--at /home/halavais/webapps/mezzanine/sparky/sparky/wsgi.py and the settings.py file is at /home/halavais/webapps/mezzanine/sparky/sparky/settings.py . But no joy is to be had.

permanent link

answered 29 Sep '16, 06:34

halavais
1
accept rate: 0%

Naturally, after posting it started working. I could run it from the command line and it was fine, so I pulled out the list from sys.path, dumped it into the python-path in httpd.conf, and then eliminated paths until I figured out what was essential. Luckily, something about that process got me to the following line:

WSGIDaemonProcess mezzanine processes=2 threads=12 python-path=/home/halavais/webapps/mezzanine/sparky:/home/halavais/webapps/mezzanine/lib/python3.5

The deal is that the path to the directory above "sparky" led to sparky.settings to be an ambiguous identifier. By taking that directory out of the path, it eliminates that issue. Just in case someone is as dumb as I was in figuring it out.

(29 Sep '16, 07:43) halavais
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×910
×28
×4

question asked: 27 Jun '12, 15:29

question was seen: 7,351 times

last updated: 29 Sep '16, 07:43

                              
WEBFACTION
REACH US
SUPPORT
LEGAL
© COPYRIGHT 2003-2021 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM