Ozan Honamlioglu
Ozan Honamlioglu

Reputation: 795

how to bring out django project from virtualenv

I have django project in virtualenv and now I am publishing it in server but the problem is I can not move project from virtualenv, when I do this then related packages inside site-package, cant be read and errors occur, how can I bring out my project from virtualenv without any issuing

Upvotes: 0

Views: 82

Answers (1)

e4c5
e4c5

Reputation: 53734

Create a new virtualenv on the server. It's easy

Step 1 Get the list of modules in the current virtualenv

source /path/to/current/bin/activate
pip freeze > /tmp/requirements.txt

Step 2 Create a new virtualenv. Login to your new server, copy the requirements file there. Then either change into a suitable directory before excuting the virtualenv command or give a full path.

 deactivate
 virtualenv -p python envname

Step 3 Install modules

source envname/bin/activate
pip install -r /tmp/requirements.txt

That's it.

As @bruno has pointed out, you really should be using a virtualenv on the server. And you should be using it on your local dev server as well. Then you can be really sure that the code will run at both ends without any surprises.

Upvotes: 2

Related Questions