On 26/02/2012 1:16pm, shartha wrote:
Yes I do. I was also instructed to add it to the root folder of my
project, but I am not sure what that means exactly. =(

I think your first thought might be correct. The path is important.

Here are two suggestions both of which have solved such problems for me in the past so I include them in all my projects as a matter of routine. One is my manage.py and the other is my wsgi file which works in all my projects ...

Good luck

Mike

- - - - - - - - - - - - - - - - - - - -

# this is my Django 1.4.x manage.py
import os, sys

if __name__ == "__main__":

SRC_ROOT = os.path.realpath(os.path.dirname(__file__)).replace('\\','/')
    PROJECT_ROOT = os.path.split(SRC_ROOT)[0].replace('\\','/')
    sys.path.append(PROJECT_ROOT)
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")
    from django.core.management import execute_from_command_line
    execute_from_command_line(sys.argv)

# end of myproject.manage.py

- - - - - - - - - - - - - - - - - - - -

# myproject.wsgi
import os, sys
project = 'myproject'
srvroot = '/srv/www'
vws_root = '%s/%s' % (srvroot, project)
src_root = '%s/%s' % (vws_root, project)

# during debugging
# sys.stdout = sys.stderr

if vws_root not in sys.path:
    sys.path.insert(0, vws_root)

if src_root not in sys.path:
    sys.path.insert(0, src_root)

os.environ['DJANGO_SETTINGS_MODULE'] = '%s.settings' % project
os.environ['PYTHON_EGG_CACHE'] = vws_root

import settings
import django.core.management
django.core.management.setup_environ(settings)
utility = django.core.management.ManagementUtility()
command = utility.fetch_command('runserver')

command.validate()

import django.conf
import django.utils

django.utils.translation.activate(django.conf.settings.LANGUAGE_CODE)

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

# end of myproject.wsgi
- - - - - - - - - - - - - - - - - - - -





On Feb 25, 7:20 pm, Mike Dewhirst<mi...@dewhirst.com.au>  wrote:
On 26/02/2012 10:10am,sharthawrote:

ImportError at /
  No module named moh

Do you have a file called __init__.py  in the directory?


--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to