[英]How should I move my completed Django Project in a Virtual Environment?
I started learning django a few days back and started a project, by luck the project made is good and I'm thinking to deploy it. 几天前,我开始学习django并开始了一个项目,幸运的是,这个项目做的很好,我正在考虑部署它。 However I didn't initiate it in virtual environment. 但是我没有在虚拟环境中启动它。 have made a virtual environment now and want to move project to that. 现在已经创建了一个虚拟环境,并希望将项目移至该环境。 I want to know how can I do that ? 我想知道该怎么做? I have created requirements.txt whoever it has included all the irrelevant library names. 无论是否包含所有不相关的库名称,我都创建了requirements.txt。 How can I get rid of them and have only that are required for the project. 我如何摆脱它们,只有项目所需的东西。
Django is completely unrelated to the environment you run it on. Django与您在其上运行的环境完全无关。
The environment represents which python version are you using (2,3...) and the libraries installed. 该环境表示您正在使用哪个python版本(2,3 ...)和已安装的库。
To answer your question, the only thing you need to do is run your manage.py
commands from the python executable in the new virtual environment. 要回答您的问题,只需要做的就是在新的虚拟环境中从python可执行文件运行manage.py
命令。 Of course install all of the necessary libraries in the new environment if you haven't already did so. 当然,如果您尚未安装所有必需的库,请在新环境中安装它们。
It might be a problem if you created a python3 environment while the one you created was in python2, but at that point it's a code portability issue. 如果您在python2中创建的环境创建了python3环境,则可能会出现问题,但那时这是代码可移植性问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.