Module Not Found Error after moving directory and back - django

After moving my directory back and forth, I am recieving the below error. Not sure how to resolve this.
The files are currently sitting in the directory they originated from. What seettings should I be looking at when I get an error like this.
C:\Users\Nathan\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\192.6817.19\bin\runnerw64.exe C:\Users\Nathan\PycharmProjects\DJANGO_TemplateApp\venv\Scripts\python.exe C:/Users/Nathan/PycharmProjects/DJANGO_TemplateApp/manage.py runserver 8000
Traceback (most recent call last):
File "C:\Users\Nathan\PycharmProjects\DJANGO_TemplateApp\venv\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Nathan\PycharmProjects\DJANGO_TemplateApp\venv\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute
super().execute(*args, **options)
File "C:\Users\Nathan\PycharmProjects\DJANGO_TemplateApp\venv\lib\site-packages\django\core\management\base.py", line 364, in execute
output = self.handle(*args, **options)
File "C:\Users\Nathan\PycharmProjects\DJANGO_TemplateApp\venv\lib\site-packages\django\core\management\commands\runserver.py", line 67, in handle
if not settings.DEBUG and not settings.ALLOWED_HOSTS:
File "C:\Users\Nathan\PycharmProjects\DJANGO_TemplateApp\venv\lib\site-packages\django\conf\__init__.py", line 79, in __getattr__
self._setup(name)
File "C:\Users\Nathan\PycharmProjects\DJANGO_TemplateApp\venv\lib\site-packages\django\conf\__init__.py", line 66, in _setup
self._wrapped = Settings(settings_module)
File "C:\Users\Nathan\PycharmProjects\DJANGO_TemplateApp\venv\lib\site-packages\django\conf\__init__.py", line 157, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\Nathan\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'DJANGO_TemplateApp'

i think this all happened because you moved your virtualenv and i think the good way to solve this is to create a new virtualenv and copy your project to it and install the requirements

Related

ModuleNotFoundError: No module named 'proj'

I ran into this problem and searched many resources but couldn't find a solution. My Django project was running successfully on my local. But when I deployed it to the server, it kept getting the following error.
ModuleNotFoundError: No module named 'proj'
I installed all the required libraries and all the settings should be correct as they worked fine on my OSX.
(venv) [root#10-10-7-140 vanilla]# python manage.py runserver
Traceback (most recent call last):
File "/data/www/vanilla/vanilla/venv/lib/python3.8/site-packages/django/core/management/base.py", line 414, in run_from_argv
self.execute(*args, **cmd_options)
File "/data/www/vanilla/vanilla/venv/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 74, in execute
super().execute(*args, **options)
File "/data/www/vanilla/vanilla/venv/lib/python3.8/site-packages/django/core/management/base.py", line 460, in execute
output = self.handle(*args, **options)
File "/data/www/vanilla/vanilla/venv/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 81, in handle
if not settings.DEBUG and not settings.ALLOWED_HOSTS:
File "/data/www/vanilla/vanilla/venv/lib/python3.8/site-packages/django/conf/__init__.py", line 87, in __getattr__
self._setup(name)
File "/data/www/vanilla/vanilla/venv/lib/python3.8/site-packages/django/conf/__init__.py", line 74, in _setup
self._wrapped = Settings(settings_module)
File "/data/www/vanilla/vanilla/venv/lib/python3.8/site-packages/django/conf/__init__.py", line 183, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/local/python3.8/python3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'proj'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/data/www/vanilla/vanilla/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
utility.execute()
File "/data/www/vanilla/vanilla/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/data/www/vanilla/vanilla/venv/lib/python3.8/site-packages/django/core/management/base.py", line 427, in run_from_argv
connections.close_all()
File "/data/www/vanilla/vanilla/venv/lib/python3.8/site-packages/django/db/utils.py", line 212, in close_all
for alias in self:
File "/data/www/vanilla/vanilla/venv/lib/python3.8/site-packages/django/utils/connection.py", line 73, in __iter__
return iter(self.settings)
File "/data/www/vanilla/vanilla/venv/lib/python3.8/site-packages/django/utils/functional.py", line 49, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/data/www/vanilla/vanilla/venv/lib/python3.8/site-packages/django/utils/connection.py", line 45, in settings
self._settings = self.configure_settings(self._settings)
File "/data/www/vanilla/vanilla/venv/lib/python3.8/site-packages/django/db/utils.py", line 148, in configure_settings
databases = super().configure_settings(databases)
File "/data/www/vanilla/vanilla/venv/lib/python3.8/site-packages/django/utils/connection.py", line 50, in configure_settings
settings = getattr(django_settings, self.settings_name)
File "/data/www/vanilla/vanilla/venv/lib/python3.8/site-packages/django/conf/__init__.py", line 87, in __getattr__
self._setup(name)
File "/data/www/vanilla/vanilla/venv/lib/python3.8/site-packages/django/conf/__init__.py", line 74, in _setup
self._wrapped = Settings(settings_module)
File "/data/www/vanilla/vanilla/venv/lib/python3.8/site-packages/django/conf/__init__.py", line 183, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/local/python3.8/python3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'proj'
I noticed the message of if not settings.DEBUG and not settings.ALLOWED_HOSTS: and checked my code in venilla/settings.py, which includes:
DEBUG = True
ALLOWED_HOSTS = ['*']
Furthermore, the following line is standard in my manage.py.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'vanilla.settings')
I checked all the libraries are installed correctly, tried to run
python manage.py makemigrations and
python manage.py check. Got the same error.
Really wondering what caused my problem. Can anyone help? Thank you.
After checking the system, I found the following line in /etc/profile.
export DJANGO_SETTINGS_MODULE=proj.settings
It seta the DJANGO_SETTINGS_MODULE to proj.settings and cannot be overwritten by manage.py. After removing it and rebooting the system, the problem is resolved.

Django new project ModuleNotFoundError: No module named 'demoapp' (virtual env's name)

I am trying to start a new Django project but running into the error ModuleNotFoundError: No module named '<XYZ>' where XYZ is the name of my virtual environment created using mkvirtualenv. This is really weird and I can't say what has changed in my system recently to cause this.
Here are steps showing how this error occurs in a brand new project:
Create the virtual environment:
~/code/projects/temp$ mkvirtualenv demoapp
created virtual environment CPython3.9.6.final.0-64 in 237ms
creator CPython3Posix(dest=/Users/ankush/.virtualenvs/demoapp, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/ankush/Library/Application Support/virtualenv)
added seed packages: pip==20.3.3, setuptools==51.3.3, wheel==0.36.2
activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
virtualenvwrapper.user_scripts creating /Users/ankush/.virtualenvs/demoapp/bin/predeactivate
virtualenvwrapper.user_scripts creating /Users/ankush/.virtualenvs/demoapp/bin/postdeactivate
virtualenvwrapper.user_scripts creating /Users/ankush/.virtualenvs/demoapp/bin/preactivate
virtualenvwrapper.user_scripts creating /Users/ankush/.virtualenvs/demoapp/bin/postactivate
virtualenvwrapper.user_scripts creating /Users/ankush/.virtualenvs/demoapp/bin/get_env_details
Install Django:
(demoapp) ~/code/projects/temp$ pip install django
Collecting django
Using cached Django-4.0-py3-none-any.whl (8.0 MB)
Collecting asgiref<4,>=3.4.1
Using cached asgiref-3.4.1-py3-none-any.whl (25 kB)
Collecting sqlparse>=0.2.2
Using cached sqlparse-0.4.2-py3-none-any.whl (42 kB)
Installing collected packages: sqlparse, asgiref, django
Successfully installed asgiref-3.4.1 django-4.0 sqlparse-0.4.2
WARNING: You are using pip version 20.3.3; however, version 21.3.1 is available.
You should consider upgrading via the '/Users/ankush/.virtualenvs/demoapp/bin/python -m pip install --upgrade pip' command.
Start a new project
(demoapp) ~/code/projects/temp$ django-admin startproject uberclone
Run the new project right away:
(demoapp) ~/code/projects/temp$ cd uberclone/
(demoapp) ~/code/projects/temp/uberclone$ ./manage.py runserver
Traceback (most recent call last):
File "/Users/ankush/.virtualenvs/demoapp/lib/python3.9/site-packages/django/core/management/base.py", line 373, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/ankush/.virtualenvs/demoapp/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 66, in execute
super().execute(*args, **options)
File "/Users/ankush/.virtualenvs/demoapp/lib/python3.9/site-packages/django/core/management/base.py", line 417, in execute
output = self.handle(*args, **options)
File "/Users/ankush/.virtualenvs/demoapp/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 73, in handle
if not settings.DEBUG and not settings.ALLOWED_HOSTS:
File "/Users/ankush/.virtualenvs/demoapp/lib/python3.9/site-packages/django/conf/__init__.py", line 84, in __getattr__
self._setup(name)
File "/Users/ankush/.virtualenvs/demoapp/lib/python3.9/site-packages/django/conf/__init__.py", line 71, in _setup
self._wrapped = Settings(settings_module)
File "/Users/ankush/.virtualenvs/demoapp/lib/python3.9/site-packages/django/conf/__init__.py", line 179, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/local/Cellar/python#3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'demoapp'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/ankush/code/projects/temp/uberclone/./manage.py", line 22, in <module>
main()
File "/Users/ankush/code/projects/temp/uberclone/./manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/Users/ankush/.virtualenvs/demoapp/lib/python3.9/site-packages/django/core/management/__init__.py", line 425, in execute_from_command_line
utility.execute()
File "/Users/ankush/.virtualenvs/demoapp/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/ankush/.virtualenvs/demoapp/lib/python3.9/site-packages/django/core/management/base.py", line 386, in run_from_argv
connections.close_all()
File "/Users/ankush/.virtualenvs/demoapp/lib/python3.9/site-packages/django/db/utils.py", line 208, in close_all
for alias in self:
File "/Users/ankush/.virtualenvs/demoapp/lib/python3.9/site-packages/django/utils/connection.py", line 73, in __iter__
return iter(self.settings)
File "/Users/ankush/.virtualenvs/demoapp/lib/python3.9/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/ankush/.virtualenvs/demoapp/lib/python3.9/site-packages/django/utils/connection.py", line 45, in settings
self._settings = self.configure_settings(self._settings)
File "/Users/ankush/.virtualenvs/demoapp/lib/python3.9/site-packages/django/db/utils.py", line 144, in configure_settings
databases = super().configure_settings(databases)
File "/Users/ankush/.virtualenvs/demoapp/lib/python3.9/site-packages/django/utils/connection.py", line 50, in configure_settings
settings = getattr(django_settings, self.settings_name)
File "/Users/ankush/.virtualenvs/demoapp/lib/python3.9/site-packages/django/conf/__init__.py", line 84, in __getattr__
self._setup(name)
File "/Users/ankush/.virtualenvs/demoapp/lib/python3.9/site-packages/django/conf/__init__.py", line 71, in _setup
self._wrapped = Settings(settings_module)
File "/Users/ankush/.virtualenvs/demoapp/lib/python3.9/site-packages/django/conf/__init__.py", line 179, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/local/Cellar/python#3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'demoapp'
I feel like there's something really dumb I'm missing, but can't seem to find it. Please help!
=== Edit 1: Adding manage.py contents ===
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'uberclone.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()

Problem with MULTPLE SETTINGS File. Django/Python

I am trying to run a Django project on my windows machine. I am getting nomodulefounderror. The project consists of multiple settings files for prod, Development, and Test.
I am using a virtual environment, Python 2.7 and Django 1.10 versions
I need help to run this project on my local machine.
Python manage.py runserver --settings=settings_dev_sai
It throws me an error. Here is my error log
python manage.py runserver --settings=bg.settings.settings_dev_sai
Traceback (most recent call last):
File "C:\Users\1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute
super().execute(*args, **options)
File "C:\Users\1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\base.py", line 369, in execute
output = self.handle(*args, **options)
File "C:\Users\1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\commands\runserver.py", line 67, in handle
if not settings.DEBUG and not settings.ALLOWED_HOSTS:
File "C:\Users\1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\conf\__init__.py", line 76, in __getattr__
self._setup(name)
File "C:\Users\1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\conf\__init__.py", line 63, in _setup
self._wrapped = Settings(settings_module)
File "C:\Users\1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\conf\__init__.py", line 142, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\1\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "F:\brdge\bridge_sai\bridge\settings.py", line 38, in <module>
from settings_dev_sai import *
ModuleNotFoundError: No module named 'settings_dev_sai'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Users\1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\base.py", line 341, in run_from_argv
connections.close_all()
File "C:\Users\1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\db\utils.py", line 225, in close_all
for alias in self:
File "C:\Users\1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\db\utils.py", line 219, in __iter__
return iter(self.databases)
File "C:\Users\1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\db\utils.py", line 153, in databases
self._databases = settings.DATABASES
File "C:\Users\1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\conf\__init__.py", line 76, in __getattr__
self._setup(name)
File "C:\Users\1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\conf\__init__.py", line 63, in _setup
self._wrapped = Settings(settings_module)
File "C:\Users\1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\conf\__init__.py", line 142, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\1\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "F:\brdge\bridge_sai\bridge\settings.py", line 38, in <module>
from settings_dev_sai import *
ModuleNotFoundError: No module named 'settings_dev_sai'
manage.py File
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bg.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
Error log Updated
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "F:\brdge\env1\lib\site-packages\django\core\management\__init__.py", line 367, in execute_from_command_line
utility.execute()
File "F:\brdge\env1\lib\site-packages\django\core\management\__init__.py", line 316, in execute
settings.INSTALLED_APPS
File "F:\brdge\env1\lib\site-packages\django\conf\__init__.py", line 53, in __getattr__
self._setup(name)
File "F:\brdge\env1\lib\site-packages\django\conf\__init__.py", line 41, in _setup
self._wrapped = Settings(settings_module)
File "F:\brdge\env1\lib\site-packages\django\conf\__init__.py", line 97, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Python27\Lib\importlib\__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named settings_dev_sai
i think that you just need run it
python manage.py runserver --settings=bridge.settings_dev_sai
because bridge.settings is a file not a package
It seems your project dir name is 'bg', so I think while importing modules you should do
from bg import settings_dev_sai
or
from bg.settings_dev_sai import *
also make sure settings_dev_sai is in same dir 'bg'
I think i need to answer my question, The problem of nomodulefounderror, due to incomplete data in my Postgres database. I had dumped .sql file into the Postgres database which was given by my manager and later configured the settings file according to the database name and run command python manage.py runserver --settings=bg.settings_dev_sai. It worked perfectly.

Error during the running django project

I'm running django project but i got this error. Can you help me with this problem?
"C:\Program Files\JetBrains\PyCharm 2017.2.2\bin\runnerw.exe" C:\Users\Jaloliddin\AppData\Local\Programs\Python\Python36-32\python.exe E:/download/manage.py runserver 8000
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x0368ED68>
Traceback (most recent call last):
File "C:\Users\Jaloliddin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.11.5-py3.6.egg\django\utils\autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "C:\Users\Jaloliddin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.11.5-py3.6.egg\django\core\management\commands\runserver.py", line 117, in inner_run
autoreload.raise_last_exception()
File "C:\Users\Jaloliddin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.11.5-py3.6.egg\django\utils\autoreload.py", line 251, in raise_last_exception
six.reraise(*_exception)
File "C:\Users\Jaloliddin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.11.5-py3.6.egg\django\utils\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "C:\Users\Jaloliddin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.11.5-py3.6.egg\django\utils\autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "C:\Users\Jaloliddin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.11.5-py3.6.egg\django\__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Jaloliddin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.11.5-py3.6.egg\django\apps\registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "C:\Users\Jaloliddin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.11.5-py3.6.egg\django\apps\config.py", line 120, in create
mod = import_module(mod_path)
File "C:\Users\Jaloliddin\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", 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 936, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'blog'
Looks like you have in your settings.py, in apps, 'blog', which cannot be found. Doublecheck your settings and your path.

Django - RuntimeError: populate() isn't reentrant

I'm trying to move my Django project to a production server(virtual machine running ubuntu server 14.04 LTS X64) freshly installed.
All I did so far is installing the project requirements.txt (no apache server installed nor mysql server)
When I try to run manage.py runserver I get this error:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.4/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.4/site-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/usr/local/lib/python3.4/site-packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python3.4/site-packages/django/apps/registry.py", line 78, in populate
raise RuntimeError("populate() isn't reentrant")
RuntimeError: populate() isn't reentrant
I have no idea how to trace the source of this issue, and if you need any information let me know.
requirements.txt:
amqp==1.4.9
anyjson==0.3.3
billiard==3.3.0.22
celery==3.1.19
dj-database-url==0.3.0
dj-static==0.0.6
Django==1.7.1
django-appconf==0.6
django-celery==3.1.17
django-compressor==1.4
django-discover-runner==1.0
django-role-permissions==0.6.2
djangorestframework==3.0.0
drf-nested-routers==0.11.1
gunicorn==19.1.1
kombu==3.0.33
mysql-connector-python==2.1.3
pytz==2015.7
six==1.8.0
static3==0.5.1
After trying running manage.pyalone, i got this error :
Traceback (most recent call last):
File "/usr/local/lib/python3.4/site-packages/django/db/utils.py", line 108, in load_backend
return import_module('%s.base' % backend_name)
File "/usr/local/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2212, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2212, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2212, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
ImportError: No module named 'mysql'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/site-packages/django/core/management/__init__.py", line 345, in execute
settings.INSTALLED_APPS
File "/usr/local/lib/python3.4/site-packages/django/conf/__init__.py", line 46, in __getattr__
self._setup(name)
File "/usr/local/lib/python3.4/site-packages/django/conf/__init__.py", line 42, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python3.4/site-packages/django/conf/__init__.py", line 94, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/local/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2212, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "/home/soufiaane/django_projects/CapValue/CapValue/__init__.py", line 5, in <module>
from .celery_settings import app as celery_app # noqa
File "/home/soufiaane/django_projects/CapValue/CapValue/celery_settings.py", line 9, in <module>
django.setup()
File "/usr/local/lib/python3.4/site-packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python3.4/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/usr/local/lib/python3.4/site-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/usr/local/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/usr/local/lib/python3.4/site-packages/django/contrib/auth/models.py", line 40, in <module>
class Permission(models.Model):
File "/usr/local/lib/python3.4/site-packages/django/db/models/base.py", line 124, in __new__
new_class.add_to_class('_meta', Options(meta, **kwargs))
File "/usr/local/lib/python3.4/site-packages/django/db/models/base.py", line 299, in add_to_class
value.contribute_to_class(cls, name)
File "/usr/local/lib/python3.4/site-packages/django/db/models/options.py", line 166, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/usr/local/lib/python3.4/site-packages/django/db/__init__.py", line 40, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/usr/local/lib/python3.4/site-packages/django/db/utils.py", line 242, in __getitem__
backend = load_backend(db['ENGINE'])
File "/usr/local/lib/python3.4/site-packages/django/db/utils.py", line 126, in load_backend
raise ImproperlyConfigured(error_msg)
django.core.exceptions.ImproperlyConfigured: 'mysql.connector.django' isn't an available database backend.
Try using 'django.db.backends.XXX', where XXX is one of:
'mysql', 'oracle', 'postgresql_psycopg2', 'sqlite3'
Error was: No module named 'mysql'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.4/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.4/site-packages/django/core/management/__init__.py", line 351, in execute
settings.configure()
File "/usr/local/lib/python3.4/site-packages/django/conf/__init__.py", line 56, in configure
raise RuntimeError('Settings already configured.')
RuntimeError: Settings already configured.
which clearly indicates that i have an issue regarding mysql database support!
after struggeling with the mysql-connector-python package i was using in my devloppment version, i couldn't get it working on my linux server due to some compatibility issues.
so i end up installing mysqlclient package insteed and it worked like a charm!