No module named django.core when running django-admin startproject myproject
django-admin startproject myproject on macOS I get the error
Traceback (most recent call last): File "/usr/local/bin/django-admin", line 2, in from django.core import management ImportError: No module named django.core
I checked out this question but running
import django won't produce any output in a python3 shell.
/usr/local/bin/django-admin is a symlink to
I already put
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django in my PYTHONPATH as suggested in other questions.
Am I missing something?
Even if you make it work, it is not good practice to do what you're doing! Ideally, the only python-related binaries you would want in /usr/local/bin/ would be python, pip and virtualenv (or venv, pyvenv)...
I would suggest you to delete
/Library/Frameworks/Python.framework/Versions/3.6 ONLY IF you installed it there. As far as I know, macOS only comes with python2.7 installed and not python3.6!
Then open a new shell and try this:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew install python3 pip3 install virtualenv cd ~/Desktop/ mkdir proj cd proj virtualenv -p python3 env source env/bin/activate pip install django django-admin.py startproject testproj
skip the first step if you already have brew installed
No module named django.core when creating project in virtualenv , For future reference, Python offers a module called venv to prevent version mishaps like this. sudo django-admin startproject myproject. If your path variables are correct and from the python shell you can do: from django.core import management , make sure you're including "python" before "django-admin.py" as such: python django-admin.py startproject thelittlethings
Check your permissions in
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ with an
ls -la command. If you see anything owned by
root, this probably needs to change. I suspect that since you installed some packages as root, the permissions are weird and it can't find the module. If this is the case, reinstall the package(s) as your own user using
Another thing you should check: as phd mentioned you need to make sure you're using the version of
python you think you are. Check this by running
which python to tell you the location of the one you're referencing, and
python --version to tell you which version you're using. If it's not Python 3.6, then you installed Django for a different version of Python. In this case, simply install Django for version 3.6 and you'll be on your way.
For future reference, Python offers a module called
venv to prevent version mishaps like this. More info can be found here.
ModuleNotFoundError: No module named 'django_project' when I , I solved this problem by using this command as following instead: django-admin startproject. just remove the ".py" attached to "django-admin". DJANGO_SETTINGS_MODULE not set, but starproject not may create new project, required setting variables. bash-4.3# export | grep DJANGO_SETTINGS_MODULE
It seems like you are trying to create or work on a django project without using a python virtual environment. I recommend reviewing the python 3 venv documenation (https://docs.python.org/3/library/venv.html). Then creating a virtual environment (venv) specifically for your web application. Once you you that project's venv setup you can install django into that venv.
No module named django.core when creating project in virtualenv, ModuleNotFoundError: No module named 'django_project' when I used coverage run I started off by creating a virtual environment in my project directory and The error only occur when I run coverage run manage.py test but other pip install coverage==5.0.2 Django==3.0 django-admin startproject I installed django using python3, but by default manage.py uses python. $ django-admin.py startproject foo $ cd foo/ $ ./manage.py startapp bar Traceback (most recent call last): File "./manage.py", line 8, in <module> from django.core.management import execute_from_command_line ImportError: No module named django.core.management $ sed -i -e 's/env python/env python3/' manage.py $ ./manage.py
On MacOS, use sudo before the command:
sudo django-admin startproject myproject
There is no module named django.core when creating a project in , No module named django.core when creating project in virtualenv. modulenotfounderror: 3) While running the new environment, I installed django: (env) path/pip install python C:/path/to/django-admin.py startproject test. I have also python %VIRTUAL_ENV%\scripts\django-admin.py startproject myproject. This runs startproject ¶ django-admin startproject name [directory]¶ Creates a Django project directory structure for the given project name in the current directory or the given destination. By default, the new directory contains manage.py and a project package (containing a settings.py and other files).
I try to do the django-admin startproject only to get the following , I solved this problem using the following command: django-admin startproject. just remove the ".py" attached to "django-admin". Writing your first Django app, part 1¶ Let’s learn by example. Throughout this tutorial, we’ll walk you through the creation of a basic poll application. It’ll consist of two parts: A public site that lets people view polls and vote in them. An admin site that lets you add, change, and delete polls. We’ll assume you have Django
DjangoGirls/tutorial, (most recent call last): File "/usr/bin/django-admin", line 18, in <module> from django.core import management ImportError: No module named django.core. ImportError: No module named django.core (fun with Windows) I just spent 45 minutes tracking this down, hopefully if I post a trace here, others will be able to resolve the issue more quickly in the future.
Django settings modules not found? ModuleNotFoundError, After i run it, i receive an error saying file "manage.py", line 8, in <module> from import execute_from_command_line Import error: No module named 'django' I found out that the message means that heroku is not making Django available mysite . instead of python myvenv\Scripts\django-admin.py startproject mysite . The Django documentation advices to put the signals inside your app config file. validation - django_wsgi. django-admin --version 'django-admin' is not recognized as an internal or external command Exception Value: No module named urls === I was running Django 1. py", line 2, in from django. site. Now whenever I run python in Terminal and type