Hi!
I’m only a beginner and so forgive me if I’ll be confusing you more (or sound condescending since I might not understand your workflow), but:
Your first error message is default behavior as far as I know - I get exactly the same warning message if I simply run django-admin
. According to the official docs for django-admin/manage.py,
[manage.py] does the same thing as `django-admin` but also sets the [ `DJANGO_SETTINGS_MODULE` ] environment variable so that it points to your project’s `settings.py` file.
You are trying to use the django-admin command to do something that Django kind of expects you to do using
python manage.py
(because it expects the DJANGO_SETTINGS_MODULE variable to be set), and so it warns you that not all django-admin-related commands are listed. It might sound very contradictory when you're typing in django-admin, that Django would think that's odd, but I can't really explain it in a better way. Try running
python manage.py
once you've got a working project to see that this returns the same list of commands, but with some extra (like auth, sessions- and staticfiles-related) commands added.
I see that you use the command ‘python3 manage.py runserver’. I’m not used to seeing that since the ‘python3’ part isn’t necessary when I set up a virtual environment in pipenv and enter the pipenv shell, all ‘python […]’ are executed using the python version specified for the virtual env. Are you not using a virtual environment? If you are using e. g. pipenv, you might try the command pipenv shell
before running django-admin startproject foo
and then python manage.py runserver
.
In case you’re not using virtual environments, you can have a look at instructions for setting pipenv up here: Chapter 1: Initial Set Up | Django For Beginners It’s import to follow the step-by-step instructions exactly before you try making variations yourself.
If you are using a virtual environment for your project and it seems to be working as it should otherwise, could you try other commands using python manage.py
? E. g. python manage.py check
, to see if that provides any helpful information. If python manage.py shell
works, you can then try
>>> import os
>>> os.sys.path
.
That will give you a list of directories that Python searches through for relevant packages. One of the directories should be named something like ‘site-packages’. Try going to that folder and see if that folder in turn contains a folder named ‘django’. If it doesn’t, that probably means your virtual environment handler isn’t working as it should. Then you can search for more specific help for e.g. venv or pipenv.
Again, apologies if I completely missed the mark.
Good luck!