ImportError when running Django sampleapp

Issue #15 resolved
Nate Aune
created an issue

I followed the Django quickstart instructions at and when I try to access the site at, I get the following error:



silver serve .

serving on

Exception happened during processing of request from ('', 40842) Traceback (most recent call last): File "/srv/silverlining/lib/python2.6/site-packages/paste/", line 1068, in process_request_in_thread self.finish_request(request, client_address) File "/usr/lib/python2.6/", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python2.6/", line 615, in init self.handle() File "/srv/silverlining/lib/python2.6/site-packages/paste/", line 442, in handle BaseHTTPRequestHandler.handle(self) File "/usr/lib/python2.6/", line 329, in handle self.handle_one_request() File "/srv/silverlining/lib/python2.6/site-packages/paste/", line 437, in handle_one_request self.wsgi_execute() File "/srv/silverlining/lib/python2.6/site-packages/paste/", line 287, in wsgi_execute self.wsgi_start_response) File "/srv/silverlining/src/silverlining/silverlining/", line 185, in call return app(environ, start_response) File "/srv/myapp/lib/python/django/core/handlers/", line 230, in call self.load_middleware() File "/srv/myapp/lib/python/django/core/handlers/", line 33, in load_middleware for middleware_path in settings.MIDDLEWARE_CLASSES: File "/srv/myapp/lib/python/django/utils/", line 276, in getattr self._setup() File "/srv/myapp/lib/python/django/conf/", line 40, in _setup self._wrapped = Settings(settings_module) File "/srv/myapp/lib/python/django/conf/", line 75, in init raise ImportError("Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)) ImportError: Could not import settings 'sampleapp.settings' (Is it on sys.path? Does it have syntax errors?): No module named sampleapp.settings


I added a file sampleapp.pth to the lib/python folder:

{{{ $ cd /srv/myapp/lib/python $ cat sampleapp.pth ../../src/sampleapp }}}

And yes, there is a directory at ../../src/sampleapp that contains the sample Django app that was created.

Comments (2)

  1. Nate Aune reporter

    Another silly problem. I misread the instructions and had a directory src/sampleapp/ that contained all of the files, instead of src/sampleapp/sampleapp. Once I added this intermediary directory, then it worked.

    What's the best way to handle this wonky directory structure with existing Django projects? A bunch of symlinks?

  2. Log in to comment