run django using nssm
Install Django using pip:
pip install django
Create a Django project:
django-admin startproject myproject
Navigate to the project directory:
cd myproject
Create a Django app:
python manage.py startapp myapp
Create a Django superuser:
python manage.py createsuperuser
Configure the database in the project's settings.py file.
Run the Django development server:
python manage.py runserver
Install NSSM (Non-Sucking Service Manager) from the official website.
Open a command prompt as an administrator.
Navigate to the directory where NSSM is installed.
Create a new service for Django using NSSM:
nssm install DjangoService C:\Path\To\python.exe C:\Path\To\manage.py runserver
Set the service startup directory:
nssm set DjangoService AppDirectory C:\Path\To\myproject
Configure service dependencies if required:
nssm set DjangoService DependOnService "Service1/Service2"
Start the Django service:
nssm start DjangoService
Open a web browser and navigate to the Django application using the assigned port.
Stop the Django service:
nssm stop DjangoService
Remove the Django service:
nssm remove DjangoService confirm