ImportError: Could not import settings. No module named oscar. inslalling django-oscar on djangohosting.ch

Dont know how to get on with this project. Spent many hours looking for the answer.

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

I use djangohosting.ch Want to install django-oscar Im not so familiar with django

Its was my intention to create virtualenv /v/ and get django-oscar up and running in one of my projects. lets call it myproject

I started creating myproject with djangohosting.ch's 1-click installer now its installed in /home/myuser/myproject

I think I got the virtualenv correctly installed in dir /v/ , and I used pip install django-oscar and I think that all vent very well. I see a bunch of directories in the /v/lib/python2.6/site-packages

But I am not sure if I set PYTHONPATH correctly. I configured the /myproject/RUN file to

PYTHONPATH=/home/myuser/v/lib/python2.6/site-packages:/home/myuser/v/lib/python2.6/site-packages/django:/home/myuser/v/lib/python2.6/site-packages/oscar:/home/myuser/myproject:/home/myuser/myproject/myproject:. python manage.py runserver 127.0.0.1:62202

I followed the setup of settings.py from this guide

edited /myproject/myproject/settings.py

And I edited the urls.py according to the guide.

I edited the /home/myuser/init/myproject file these lines

PYTHONPATH="$HOME/v/lib"
DAEMON=$HOME/v/bin/python

Havent got a clue what Im doing to be honest. I wish I understand more of all this.

Thank You for helping me

Here is what I get:

michaelh@s10:~$ cd myproject
michaelh@s10:~/myproject$ python manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 261, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 69, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/usr/lib/pymodules/python2.6/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/usr/lib/pymodules/python2.6/django/core/management/commands/syncdb.py", line 8, in <module>
    from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
  File "/usr/lib/pymodules/python2.6/django/core/management/sql.py", line 6, in <module>
    from django.db import models
  File "/usr/lib/pymodules/python2.6/django/db/__init__.py", line 11, in <module>
    if DEFAULT_DB_ALIAS not in settings.DATABASES:
  File "/usr/lib/pymodules/python2.6/django/utils/functional.py", line 184, in inner
    self._setup()
  File "/usr/lib/pymodules/python2.6/django/conf/__init__.py", line 42, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/lib/pymodules/python2.6/django/conf/__init__.py", line 95, in __init__
    raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'myproject.settings' (Is it on sys.path?): No module named oscar

Answers


I'm not sure what djangohosting.ch looks like but if you have a wsgi setup it should look something like this:

apache2/conf/httpd.conf This file has more but usually has most of it setup by your host, these areas you may have to adjust

WSGIDaemonProcess cpm processes=5 python-path=/home/myuser/myproject/:/home/myuser/myproject/myproject:/home/myuser/v/lib/python2.6/ threads=1

WSGIScriptAlias / /home/myuser/myproject/wsgi.py

wsgi.py

import os
import sys
from django.core.handlers.wsgi import WSGIHandler

sys.stdout = sys.stderr

from site import addsitedir
addsitedir('/home/myuser/v/lib/python2.6/site-packages')

from os.path import abspath, dirname, join
from django.conf import settings

os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
application = WSGIHandler()

If this isn't your setup I would at least try changing your python path to what I have in the httpd.conf file


Need Your Help

Cannot verify enterprise app using distributed provisioning profile in iOS 10

ios xcode ipad ios10

I upgraded iPad Air device to iOS10 and trying to trust the enterprise app by following the this process.