Batch file that automatically generates the structure described in w3school to create Django projects
- Download the file createdjango.bat.
- Place it in the root directory of your Django project.
- Double-click on
createdjango.bat
.
The createdjango.bat
script automates the setup of a Django project environment. It performs the following tasks:
- Check Python version: Verifies if Python is installed on the system.
- Check pip version: Ensures that pip, the Python package installer, is available.
- Create virtual environment: Checks if a virtual environment named
myworld
exists. If not, creates one. - Activate virtual environment: Activates the
myworld
virtual environment. - Upgrade pip: Upgrades pip to the latest version within the virtual environment.
- Install Django: Installs Django using pip.
- Request Django project name: Prompts the user to enter a name for the new Django project.
- Create Django project: Uses
django-admin
to create a new Django project with the specified name. - Verify project creation: Checks if the project was created successfully and provides feedback
- Install Bootstrap 5: Optionally installs Bootstrap 5 using
django-bootstrap-v5
. - Create run script: Generates a batch file to easily start the Django development server for the new project.
This script simplifies the initial setup process for Django projects, ensuring that all necessary components are installed and configured correctly.