1

I'm new to django and I would like to follow this tutorial: https://docs.djangoproject.com/en/2.1/intro/tutorial01/

Unfortunately, django-admin is not in my path.

When I try to run the django-admin.py script directly, I have the following error:

$ /usr/local/lib/python3.7/site-packages/django/bin/django-admin.py
Traceback (most recent call last):
 File "/usr/local/lib/python3.7/site-packages/django/bin/django-admin.py", line 2, in <module>
 from django.core import management
ImportError: No module named django.core

Here is my configuration:

  • System: macOS 10.13
  • Python: 3.7.0 (installed via Homebrew
  • Django: 2.1.4

What am I doing wrong?

asked Dec 10, 2018 at 11:49
1

2 Answers 2

2

I think You don’t install django correctly. If you are highly new in django then follow these steps to setup your clean and new project environment

Create your project folder

mkdir myProject

Open this Project Folder

cd myProject

Create virtual environment

python3 -m venv env

Now, active this virtual environment

source env/bin/activate

It’s time to install the Django

pip install django

Create your first project

django-admin startproject myProject

Open this Project

 cd myProject

Open your server to check it either it’s work successfully or not

python manage.py runserver
answered Dec 10, 2018 at 16:36
Sign up to request clarification or add additional context in comments.

1 Comment

Most Welcome 🙂
0

First check if django is installed by running python -c "import django". If that is successful check if django-admin command is in your python path. If you are using a virtual environment check under virtual environment/bin/. If there is no file such as django-admin then the first solution would be to try reinstalling django. Same case if you are working outside a virtual environment. If none of the above solves it then check if you have both python 2 and 3. If you do check whether .py files are being associated to python 2 instead of python3.

answered Dec 10, 2018 at 16:02

1 Comment

django-admin is not in my path but when I try to launch it from my location (like I do in my post), I have an error so I don't think adding /usr/local/lib/python3.7/site-packages/django/bin would help in anyway.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.