Setting Up Django
Setting Up Django
Installing Python and Django
Django requires Python 3.8 or later. Check whether Python is already installed:

The best practice is to create a virtual environment for every Django project. This keeps your project's dependencies isolated from your system Python and from other projects.



Creating Your First Django Project

Visit http://127.0.0.1:8000 in your browser. You'll see the Django welcome page a green rocket and the message "The install worked successfully."
Tip: runserver watches your files and reloads automatically when you save changes, just like Angular's ng serve. You don't need to restart it every time you edit a file.
Understanding Project Structure
When you open the project in Visual Studio Code, you'll see the following files and folders in the Explorer panel.
- myproject/ (Outer Folder) – The main project folder that contains all the project files. You can rename this folder if needed.
- __pycache__/ – Stores compiled Python files to improve application performance. You don't need to modify this folder.
- __init__.py – Marks the myproject folder as a Python package, allowing Python to recognize it as a module.
- asgi.py – The entry point for ASGI-compatible web servers. It is mainly used for asynchronous applications and deployments.
- settings.py – The main configuration file for your Django project. It contains project settings such as installed apps, database configuration, middleware, templates, static files, and security settings.
- urls.py – The root URL configuration file. It maps incoming URLs to the appropriate views in your application.
- wsgi.py – The entry point for WSGI-compatible web servers. It is commonly used when deploying Django applications to production.
- db.sqlite3 – The default SQLite database created by Django. It stores your application's data during development.
- manage.py – A command-line utility used to manage your Django project. You can use it to run the development server, create applications, apply migrations, create superusers, and execute many other Django management commands.
Note: The outer myproject folder acts as the project container, while the inner myproject folder contains the project's core configuration files. The manage.py file is located outside the inner folder because it is used to manage the entire project.











