1

im deploying my django project, named "Hesperides" under a webfaction server. The default project's folder in webfaction it's "myproject" so Im having this error:

ImportError: Could not import settings 'myproject.settings' (Is it on sys.path?): No module named myproject.settings

The question is: How can i do to import the settings from Hesperides.settings instead from myproject.settings? Thanks for your time.

My httpd.conf:

WSGIDaemonProcess jinn processes=2 threads=12 python-path=/home/zeioth/webapps/jinn:/home/zeioth/webapps/jinn/myproject:/home/zeioth/webapps/jinn/lib/python2.7:
WSGIScriptAlias / /home/zeioth/webapps/jinn/myproject/Hesperides/wsgi.py

My wsgi.py

import os
import sys

from django.core.handlers.wsgi import WSGIHandler
os.environ['DJANGO_SETTINGS_MODULE'] = 'Hesperides.settings'
application = WSGIHandler()

My folder tree:

jinn
  --apache2
    -bin
    --conf
      -httpd.conf
      -mime.types
    -lib
    -logs
    -modules
  -bin
  -lib
  --myproject
    -manage.py
    --Hesperides
      -wsgi.py
      -urls.py
      -__init__.py
      -settings.py
      -apps
Adrian Lopez
  • 2,601
  • 5
  • 31
  • 48
  • 1
    Seems to me your `settings.py` is actually inside `myproject`. Have you tried to copy/paste `settings.py` inside `Hesperides` folder? – Paulo Bu Jun 19 '13 at 17:58
  • no, this is myproject folder: http://oi39.tinypic.com/mjsscw.jpg – Adrian Lopez Jun 19 '13 at 18:06
  • 1
    I don't understand quite well your file tree structure.Try this instead `os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Hesperides.settings")` – Paulo Bu Jun 19 '13 at 18:10
  • Im having the same problem. i don't know there could be the problem. http://oi42.tinypic.com/d9pqf.jpg – Adrian Lopez Jun 19 '13 at 18:23
  • Can you post the exception full traceback? Try to search within your project for myproject.settings. Maybe it's not wsgi.py – Paulo Bu Jun 19 '13 at 18:43

2 Answers2

0

PROBLEM SOLVED: These are the steps to change your project directory under webfaction:

1-in httpd.conf in webapps/yourappname/apache2 set:

WSGIScriptAlias / /home/zeioth/webapps/jinn/myproject/yourNewName/wsgi.py

2-in your app's manage.py set:

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "yourNewName.settings")

3-in your app's wsgi.py set:

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

4-In your app's settings.py set:

WSGI_APPLICATION ='yourNewName.wsgi.application'

Now, runserver should work, or tell you if you need to install some module.

Adrian Lopez
  • 2,601
  • 5
  • 31
  • 48
0

Note that when you have use WSGIDaemonProcess you need to have a corresponding WSGIProcessGroup directive else your WSGI application will not be delegated to run in that daemon process group. WebFaction was generating a broken configuration file for a while if I remember. That or you copied this from one of the blog posts out there which have broken examples. Read:

Graham Dumpleton
  • 57,726
  • 6
  • 119
  • 134