Shift N' Tab Shift N' Tab - 1 year ago 152
Python Question

How to run django server with ACTIVATED virtualenv using batch file (.bat)

I found this post to be useful on how to code a batch file to automate django web server start.

But the problem is, there is no virtualenv activated, How can i activate it before the runserver inside the script?

I would like to run this server with virtualenv activated via batch file.

Answer Source

Found my solution by encoding this:

@echo off
cmd /k "cd /d C:\Users\[user]\path\to\your\env\scripts & activate & cd /d C:\Users\[user]\path\to\your\env\[projectname] & python runserver"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download