Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

273
Views
django project not working in virtualenv

I recently installed a virtualenv and cloned an existing django project into it. When I run python manage.py runserver I'm getting the following error:

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/user/eb-virt/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/Users/user/eb-virt/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/user/eb-virt/lib/python2.7/site-packages/django/core/management/__init__.py", line 261, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/Users/user/eb-virt/lib/python2.7/site-packages/django/core/management/__init__.py", line 69, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/Users/user/eb-virt/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/Users/user/eb-virt/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 8, in <module>
    from django.core.servers.basehttp import AdminMediaHandler, run, WSGIServerException, get_internal_wsgi_application
  File "/Users/user/eb-virt/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 26, in <module>
    from django.views import static
  File "/Users/user/eb-virt/lib/python2.7/site-packages/django/views/static.py", line 95, in <module>
    template_translatable = ugettext_noop(u"Index of %(directory)s")
  File "/Users/user/eb-virt/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 75, in gettext_noop
    return _trans.gettext_noop(message)
  File "/Users/user/eb-virt/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 48, in __getattr__
    if settings.USE_I18N:
  File "/Users/user/eb-virt/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
    self._setup()
  File "/Users/user/eb-virt/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
    self._wrapped = Settings(settings_module)
  File "/Users/user/eb-virt/lib/python2.7/site-packages/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 'application-name.settings' (Is it on sys.path?): No module named application-name.settings

when I try doing application-name/application python manage.py runserver, I get the following error:

python: can't open file 'manage.py': [Errno 2] No such file or directory

here is the application directory

application-name/
    manage.py
    application/
       __init__.py
       urls.py
       wsgi.py
       settings.py
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

First, rename your application-name to application_name. Dashes and Python source is just inviting problems, best not wake the dragons.

Let's assume you've put it in ~/work/application_name, i.e. outside your virtualenv.

If you didn't create the virtualenv with virtualenvwrapper and it doesn't have a setup.py file, then delete it (and install virtualenvwrapper).

Create your virtualenv with virtualenvwrapper:

mkvirtualenv -a ~/work/application_name -r ~/work/application_name/requirements.txt eb_virt

-a add an existing directory as a project dir (puts it on the python path for this virtualenv). -r runs pip install -r on the argument (I'm assuming application_name/requirements.txt exists).

Instead of using the -a option (and assuming application_name/setup.py exists), you can install your package in development mode :

cd ~/work
pip install -e application_name

Either of these make ~/work/application_name part of the module search path when Python is running. Your settings file path must start relative to a directory on Python's module search path.

The DJANGO_SETTINGS_MODULE environment variable, should therefore be set to 'application.settings'.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!