For me the above didn't work and therefore I will provide a more general answer.
But first specifically, this worked for me:
- Open a notepad
- paste this:
@echo off
CALL c:\1\env\Scripts\activate.bat
python c:\1\app.py runserver
- save as whatever.bat
- double-click this file to run
And generally: it is important to locate "activate.bat" under your python project. My project in this case was in c:\1 and the activate.bat under the relative directory env\Scripts which apparently may be situation dependent or have changed over time. This makes the general script:
@echo off
CALL [Your python project path]\[the relative path of your activate.bat]\activate.bat
python [Your python project path]\[your python filename].py runserver
In my case the project path was: c:\1
The relative path: env\Scripts
And the python filename: app
When I make a virtual environment the env files are placed relative to my python file. Just in case your situation is like in the question the call line in the script would change to
CALL [your activate.bat location]\activate.bat
i.e. in this situation the following should work:
@echo off
CALL C:\Users\Admin\Desktop\venv\Scripts\activate.bat
python C:\Users\Admin\Desktop\helloworld\manage.py runserver
Tip: I just found that python took my desktop as the working directory. It may therefore be a good idea to change your working directory to your python path. In my case adding cd\1 under @echo off does that trick.