First of all, I am new with Django.
Per the instructions in “Quick install guide | Django documentation | Django” subsection
“Install Django” it reads: "In the command prompt, ensure your virtual environment
is active, and execute the following command: …> py -m pip install Django
(Q1) Where is that virtual environment?.
I have issue the following command without any errors:
1- pip install Django==3.2.6
2- py --version
3- py -m pip install Django
4- django-admin --version
5- py -m pip install colorama
6- py -m pip install Django
7- python -m django : And generated a massive error, as follows: Note that only
Django core commands are listed as settings are not properly configured (error:
Requested setting INSTALLED_APPS, but settings are not configured. You must
either define the environment variable DJANGO_SETTINGS_MODULE or call
settings.configure() before accessing settings.). So I really don’t know what’s going
on since I went to the main search field in W10, typed Django, and the only thing
that appears is a folder I created 6 days ago. !!
Q2 Where is Django?!!
Additionally, Django does NOT appeared under Control Pannel > Uninstall
programs. So, it appears it never installed.
Q3 Why all Django related commands work but Django seems NOT to be
installed (I installed it)?
Super important note: Harvard University CS50 Curriculum requires Django.
I am stuck progress-wise. Help !
Ladies And Gentlemen, ant feedback will be welcomed and appreciated
Q1 - That is a Python question more than a Django question. See venv — Creation of virtual environments — Python 3.9.6 documentation The specific answer is going to depend a lot about your environment, and choices you need to make.
Q2 - When installed within the virtual environment, it will be within the site-packages directory inside that virtual environment.
Q3 - Django is not a “Windows application”. It’s a library that is part (installed inside) your Python environment.
They should then be providing guidance on how they suggest or want it installed.
Finally, regardless of any other items, I strongly suggest you start with the installation guide and then work your way through the official Django tutorial.
Hi Ken, thank you very much for your reply.
Regarding your reply #1: I am totally new, I don’t know what kind of environment I need and choices to make. I only know I need to study Django and and do project1 (2nd Project). Do the “Virtual environment” allows you to choose a “student environment” or a “basic environment” or a “local environment”?.
Regarding your reply #2: You wrote “When installed within the virtual environment”, Is there a possibility to install Django locally in my computer? That will be great !!!
Regarding your reply #3: Ok. I hope and I need to have it installed. My Python installation is local.
Reg the Harvard Curriculum: It is easier to get an answer from the Miami DMV or an answer from the IRS or an appointment with immigration than getting someone to talk to or to answer to from the Harvard curriculum team. Funny but true.
Again, my apologies from being so new with Django (Which I find amazing what it can do, based on the articles I read), and hope you’ll find some few minutes for a feedback.
All virtual environments (venv) are local. It’s Python’s way of setting up an environment that is isolated from other environments on your system. For example, you might have a venv for Django version 3.2, and another for Django 3.1. Or, since this is fundamentally a Python issue (not just Django), you may have a venv without Django at all. Again, the docs at venv — Creation of virtual environments — Python 3.9.6 documentation (and the link to PEP 405 -- Python Virtual Environments | Python.org and Installing packages using pip and virtual environments — Python Packaging User Guide) provide a lot of information.
So if I were to break this down into steps:
- Install Python (Python Releases for Windows | Python.org)
- Create a virtual environment (and then activate it)
- Install Django (How to install Django | Django documentation | Django)
- Work through the Django tutorial (Writing your first Django app, part 1 | Django documentation | Django)
I’ll also recommend that if you’re going to follow those steps, you should avoid all other tutorials. There are many ways of setting things up, and frequently, different tutorials will present different methods. Trying to mix steps from different sources tends to create confusion and cause problems.
So regardless of what source of information you choose, pick one and work through it.
Step-1: Done. I have Python installed.
Step-2: Created a virtual environment and activated:
I was able to issue the first 3 commands (From the link u provided and
from the command prompt as an admin), but unknown how to issue the
4rth command. I tried: C:\Users\tempo\Django>venv env_dir and
got the following error:
Error: ‘venv’ is not recognized as an internal or external command,
operable program or batch file.
If you have an idea how to build the venv command to create a virtual
Python environment in the target directory C:\Users\tempo\Django> , I
will highly appreciate the “how to” issue that command. Thanks. DH
Virtual environments are not created as admin. They’re intended to be by-user, not (necessarily) system wide.
What specifically is the 4th command you’re referring to?
When I wrote “as admin”, I meant that when I invoke the command prompt in W10, it gives you the option to run the command prompt as “an administrator”, and that is what I chosed. The 4th command is the one found right below the sentence " The command, if run with
-h , will show the available options:" within the URL provided.
The grean area below the sentence “The command, if run with
-h , will show the available options:” shows how to build and issue the command to (verbatim) "Creates virtual Python environments in one or more target directories."
I even tried this:
‘venv’ is not recognized as an internal or external command,
operable program or batch file.
Again, please copy into your reply the exact command the doc is telling you to run.
And yes, I know exactly what you’re referring to regarding admin. That’s not what you want / need to do here. There is no reason to create a virtual environment within an admin context.
I don’t know how I did it, but the links you provided were instrumental !!
I installed Django !!!. Thank you.
I feel closer to have the environment ready.
I don’t know how I did it, but I seem to have all the files he has in the video
I do apologized for not placing the command I was questioning. I read your reply.
I only have one question which the colleagues I am working with don’t know either.
How do we get the same application or the same editor or the same something the tutor uses to issue commands**?**
Please look at this pict, within it you will see has something called django-admin
Sorry, I cannot add another media because I am new in the forum. I’ll put it in the next msg.
From where a “django-admin” comes from**?**
Can an issue all my commands from the command prompt and from Visual Studio Code (There is a big file called django.py that popped up in mi Visual studio code)?