Batch file that automates the creation and setup of Django projects, including virtual environments, project initialization, and utility scripts.
- Download the file createdjango.bat.
- Place it in the directory where you want to create your Django project.
- Double-click on
createdjango.bat
and follow the prompts.
The createdjango.bat
script performs the following tasks:
- Check Python version: Ensures Python is installed on the system.
- Check pip version: Verifies that pip is available.
- Create virtual environment: Prompts for a virtual environment name and creates it if it doesn't exist.
- Activate virtual environment: Activates the virtual environment.
- Upgrade pip: Updates pip to the latest version.
- Install Django: Installs Django in the virtual environment.
- Request Django project name: Ensures the project name is valid and not already in use.
- Create Django project: Initializes a new Django project using
django-admin
. - Verify project creation: Confirms the project was created successfully.
- Generate utility scripts:
- Module installation script: Creates
CD_install_modules.bat
to install additional Python modules. - Run server script: Creates
CD_run_<project_name>.bat
to start the Django development server. - Application creation script: Creates
CD_create_apps.bat
to add new Django applications to the project.
- Module installation script: Creates
CD_install_modules.bat
: Allows you to install additional Python modules and reminds you to add them toINSTALLED_APPS
in your Django settings.CD_run_<project_name>.bat
: Activates the virtual environment and starts the Django development server.CD_create_apps.bat
: Automates the creation of new Django applications within the project.
This script simplifies the setup process for Django projects, ensuring all necessary components are configured correctly.