how can i fix ImportError: No module named 'archive.settings'

557 views
Skip to first unread message

Body Abdo

unread,
Jul 4, 2017, 7:29:09 PM7/4/17
to Django users
python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/var/www/project/venv/lib/python3.5/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "/var/www/project/venv/lib/python3.5/site-packages/django/core/management/__init__.py", line 307, in execute
    settings.INSTALLED_APPS
  File "/var/www/project/venv/lib/python3.5/site-packages/django/conf/__init__.py", line 56, in __getattr__
    self._setup(name)
  File "/var/www/project/venv/lib/python3.5/site-packages/django/conf/__init__.py", line 41, in _setup
    self._wrapped = Settings(settings_module)
  File "/var/www/project/venv/lib/python3.5/site-packages/django/conf/__init__.py", line 110, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/var/www/project/venv/lib64/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'archive.settings'


my setting:
import os
import sys

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'd*d9q(5zn)6uv9ep$-qjsh3e&o^63=n64j%s&*w#*1voa3+e$x'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []

IMPORT_EXPORT_USE_TRANSACTIONS = True

# Application definition

INSTALLED_APPS = [
'archive',
'import_export',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'bootstrap3',

James Schneider

unread,
Jul 4, 2017, 8:42:25 PM7/4/17
to django...@googlegroups.com

  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'archive.settings'

If I had to guess, you're missing the settings.py file in the root of your Django project. That should have been created by the 'django-admin.py startproject' command. 

-James

Antonis Christofides

unread,
Jul 5, 2017, 2:27:07 AM7/5/17
to django...@googlegroups.com

Hi,

The most likely explanation is that your settings file has the wrong name or location. It should be "settings.py", and it should be in the "archive" directory.

"archive" should not normally be in INSTALLED_APPS, unless you really know what you are doing, which you probably don't (yet). By default Django has a "project" subdirectory and "apps" directories; settings.py in in the "project" subdirectory and the "apps" directories are apps that are specified in INSTALLED_APPS.

Regards,

Antonis

Antonis Christofides
http://djangodeployment.com
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/60c53c4a-3b34-4564-8bbf-b3e292ea16b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages