run django using nssm

  1. Install Django using pip: pip install django

  2. Create a Django project: django-admin startproject myproject

  3. Navigate to the project directory: cd myproject

  4. Create a Django app: python manage.py startapp myapp

  5. Create a Django superuser: python manage.py createsuperuser

  6. Configure the database in the project's settings.py file.

  7. Run the Django development server: python manage.py runserver

  8. Install NSSM (Non-Sucking Service Manager) from the official website.

  9. Open a command prompt as an administrator.

  10. Navigate to the directory where NSSM is installed.

  11. Create a new service for Django using NSSM: nssm install DjangoService C:\Path\To\python.exe C:\Path\To\manage.py runserver

  12. Set the service startup directory: nssm set DjangoService AppDirectory C:\Path\To\myproject

  13. Configure service dependencies if required: nssm set DjangoService DependOnService "Service1/Service2"

  14. Start the Django service: nssm start DjangoService

  15. Open a web browser and navigate to the Django application using the assigned port.

  16. Stop the Django service: nssm stop DjangoService

  17. Remove the Django service: nssm remove DjangoService confirm