Django ModuleNotFoundError: No module named 'settings'

Related searches
The Problem

When I try to run 'python runserver' I get this error:

    Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x1068ddc80>
Traceback (most recent call last):
  File "/Users/aricliesenfelt/.virtualenvs/django/lib/python3.6/site-packages/django/utils/", line 227, in wrapper
    fn(*args, **kwargs)
  File "/Users/aricliesenfelt/.virtualenvs/django/lib/python3.6/site-packages/django/core/management/commands/", line 117, in inner_run
  File "/Users/aricliesenfelt/.virtualenvs/django/lib/python3.6/site-packages/django/utils/", line 250, in raise_last_exception
  File "/Users/aricliesenfelt/.virtualenvs/django/lib/python3.6/site-packages/django/utils/", line 685, in reraise
    raise value.with_traceback(tb)
  File "/Users/aricliesenfelt/.virtualenvs/django/lib/python3.6/site-packages/django/utils/", line 227, in wrapper
    fn(*args, **kwargs)
  File "/Users/aricliesenfelt/.virtualenvs/django/lib/python3.6/site-packages/django/", line 27, in setup
  File "/Users/aricliesenfelt/.virtualenvs/django/lib/python3.6/site-packages/django/apps/", line 108, in populate
  File "/Users/aricliesenfelt/.virtualenvs/django/lib/python3.6/site-packages/django/apps/", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/Users/aricliesenfelt/.virtualenvs/django/lib/python3.6/importlib/", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/Users/aricliesenfelt/Desktop/scratch/django/django_tutorials/supplyai/ingest/", line 5, in <module>
ModuleNotFoundError: No module named 'settings'

Here is my

from django.conf.urls import url, include
from django.contrib import admin
from rest_framework.urlpatterns import format_suffix_patterns

urlpatterns = [
    url(r'^ingest/', include('ingest.urls'))

urlpatterns = format_suffix_patterns(urlpatterns)

Here is my where I am just trying to import the local file I have. Not the main file, but the one I made locally for this app.

from sqlalchemy import create_engine, Column, Integer, String, DateTime
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.engine.url import URL

import settings

DeclarativeBase = declarative_base()

def db_connect():
    return create_engine(URL(**settings.DATABASE))

def create_data_table(engine):

class Data(DeclarativeBase):
    __tablename__ = 'data'

    id = Column(Integer, primary_key=True)
    shipper_name = Column('shipper_name', String)
    seller_location = Column('seller_location', String)
    buyer_location = Column('buyer_location', String)
    product_category = Column('product_category', String)
    order_created_date = Column('order_created_date', String)

    def __init__(self, id, shipper_name, seller_location, buyer_location, product_category, order_created_date): = id
        self.shipper_name = shipper_name
        self.seller_location = seller_location
        self.buyer_location = buyer_location
        self.product_category = product_category
        self.order_created_date = order_created_date

When I try to run the server, it is telling me that it cant find, but is literally in the same app that is in. Not sure why this is happening. Any help would be GREATLY appreciated.

You will need to import it using the full path. Try

from ingest import settings

Django settings modules not found? ModuleNotFoundError, coverage run test --settings . But when I setup travis, I get an error: ModuleNotFoundError: No module named� I am trying to start up a very basic web app with Django and getting ModuleNotFoundError: No module named 'ui' My django project is frontend_project and the app is ui Tree: front_end ├── front-end/

Replace to import settings with from django.conf import settings

ModuleNotFoundError: No module named 'django.apps' � Issue , ModuleNotFoundError: No module named 'django.apps' #5794. Closed. hipertracker opened this issue on Jan 26 � 1 comment. Closed� The top level folder is not a Python module, it’s the one that contains the that is. Therefore you want to import emailservice , without the prefix. krsanu555 April 3, 2020, 12:14pm

Load Settings from django
def setup_settings():
    import os
    import django

    # Connect to the Django Database
    script_path = os.path.dirname(__file__)

def load_settings():

    from django.core.exceptions import ImproperlyConfigured

        from django.conf import settings as settings
        settings.BASE_DIR <<<< Try to access one your settings
    except (ImproperlyConfigured, ModuleNotFoundError) as ex:
        print("Settings not loaded yet.. Load it now.")
        from django.conf import settings as settings
        print("BASE_DIR (%s) loaded." % settings.BASE_DIR)
    except Exception as ex:
        print("Could not load settings (%s)" % ex)

    if not hasattr(settings, 'BASE_DIR'):
        print("Could not find BASE_DIR in settings! ERROR!")

    return settings

Than in every file you just call this two lines:

import load_settings
settings = load_settings()

ModuleNotFoundError: No module named 'django_project' when I , ModuleNotFoundError: No module named 'django_project' when I used When trying to run test for my django project using coverage run� 1.The name of the module is incorrect. The first reason for this error is the name of the module is incorrect, so you have to check out it 2.The path of the module is incorrect. Probably you would want to import a module file, but this module is not in the same directory.

ModuleNotFoundError: No module named 'django', If you got the error “ModuleNotFoundError: No module named 'django'” it means that Python couldn't find your Django package. Here's the full error message: Traceback (most recent call last): File "", line 10, in main from django. core. Well, I resolved it myself. Polls module was not found because it was created outside the project directory. When I removed it and recreated inside the project directory, it was OK now.

Browse other questions tagged python django django-debug-toolbar or ask your own question. The Overflow Blog The Loop, August 2020: Community-a-thon

"ModuleNotFoundError: No module named 'rest_framework'" It will ask you to import the given package, that is rest_framework and run the code again. This worked for me and trying to solve that error for a couple of days.

  • Try using from supplyai.ingest import settings