Python 如何使用使用pip打包的django项目?
我刚刚写完一个django项目,使用以下方法打包:Python 如何使用使用pip打包的django项目?,python,django,python-2.7,pip,pypi,Python,Django,Python 2.7,Pip,Pypi,我刚刚写完一个django项目,使用以下方法打包: $ python setup.py sdist $ python setup.py register $ python setup.py sdist upload 现在已经准备好了,在pypi中等待 我创建了一个全新的VirtualEnvironment,激活它,然后点击 $ pip install qkreator “qkreator”是我的包的名称:) 我该如何运行它? 它现在安装在virtualenv的/lib/python2.7
$ python setup.py sdist
$ python setup.py register
$ python setup.py sdist upload
现在已经准备好了,在pypi中等待
我创建了一个全新的VirtualEnvironment,激活它,然后点击
$ pip install qkreator
“qkreator”是我的包的名称:)
我该如何运行它?
它现在安装在virtualenv的/lib/python2.7/site packages/quick\u creator/
中,但是它里面没有manage.py文件,即使我在打包所有内容时将其包含在MANIFEST.in中
(在开发项目时,我使用$python manage.py runserver
运行它)
另外,在my settings.py文件中还有一些完整路径。我该如何让这些充满活力 为了使settings.py中的路径成为动态的,您可以使用以下方法:
import os.path
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) #set PROJECT_ROOT to the path where your settings.py is available
STATIC_ROOT = os.path.join(PROJECT_ROOT,'static/') #join PROJECT_ROOT with the relative folder where static files are to be found
为了使settings.py中的路径成为动态路径,可以使用以下方法:
import os.path
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) #set PROJECT_ROOT to the path where your settings.py is available
STATIC_ROOT = os.path.join(PROJECT_ROOT,'static/') #join PROJECT_ROOT with the relative folder where static files are to be found