Python | Django
How to Install Python and Set Up the PATH Variable on Windows
Step 1: Download and Install Python
1. Visit the official Python website: Download Python
2. Choose the latest stable version and download the installer.
3. Run the installer and check the box that says Add Python to PATH before proceeding.
4. Follow the installation prompts to complete the setup.
Step 2: Manually Set the PATH Variable (If Not Added During Installation)
If you didn’t check the Add Python to PATH option during installation, follow these steps:
1. Open the Run dialog by pressing Win + R
.
2. Type sysdm.cpl
and press Enter to open System Properties.
3. Go to the Advanced tab and click on Environment Variables.
4. Under System Variables, find and select Path
, then click Edit.
5. Click New, then enter the path to your Python installation (e.g., C:\PythonXX\
or C:\Users\YourUsername\AppData\Local\Programs\Python\PythonXX\
).
6. Click OK to save your changes.
Step 3: Verify the Installation
1. Open Command Prompt (Win + R
, then type cmd
and press Enter).
2. Type the following command and press Enter:
If Python is correctly installed and added to PATH, you should see the installed version displayed.
also add scripts in path other wise pip will not work.
Install Python & Django
Step 1: Install Python & Django
Make sure you have Python installed. Check by running:
If not installed, download it from Python.org.
Now, install Django:
Step 2: Create a Django Project
Navigate to your desired folder in the terminal and run:
cd myproject
Step 3: Run the Development Server
Open http://127.0.0.1:8000/ in your browser—you should see the Django welcome page! 🎉
Next Steps:
Create a Django App:
Register the App in settings.py:
Add 'myapp'
to the INSTALLED_APPS
list.
Create a Basic View:
Open myapp/views.py
and add:
Map a URL:
In myapp/urls.py
(create if not exists):
Then, in myproject/urls.py
, include it:
Run the server again and visit http://127.0.0.1:8000/ to see "Hello, Django!".
To run migration
Comments
Post a Comment