简体   繁体   English

如何在虚拟环境中移动完成的Django项目?

[英]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.

相关问题 我是否应该在新的 Django 虚拟环境中重新开始我的项目 - Should I start over my project in a new Django Virtual Environment Django 问题 - 我应该在同一个虚拟环境中开始一个新项目吗? - Django Question - Should i start a new project in the same virtual environment? 如何确保我的 django 项目正在使用我为其创建的虚拟环境? - How to make sure that my django project is using virtual environment that i created for it? 我应该为每个项目创建一个虚拟环境吗? - Should I be creating a virtual environment for each project? 我无法在我的虚拟环境中安装 Django - I cannot install Django in my Virtual Environment Visual Studio 代码 - 我应该在我的项目文件夹中的虚拟环境中安装 python 吗? - visual studio code-should I install python in virtual environment in the folder of my project? 每次我为我的虚拟环境安装 django 时,我最终都会在全球范围内安装它。 如何仅为虚拟环境安装 django? - Everytime I install django for my virtual environment I end up installing it globally. How to install django for virtual environment only? 在Django中启动项目后,我应该将项目文件移动到父目录中吗? - Should I move my project files into the parent directory after starting a project in Django? 如何知道我当前的 Django 项目是在哪个虚拟环境下创建的? - How to know my current Django project was created under which virtual environment? 如何在虚拟环境中找到我的Django安装? - How do I find my Django install within my virtual environment?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM