如何解决具有django和django-extensions的PyInstaller
我正在尝试使用PyInstaller使用django构建可执行文件,并使用django-extensions库使用'runserver_plus'。
使用
django==1.11
PyInstaller==3.4
django-extensions==2.2.1
INSTALLED_APPS = (
...
'django_extensions',)
在Django的PyInstaller加载程序文件中,
PyInstaller\loader\rthooks\pyi_rth_django.py
import django.core.management
import django.utils.autoreload
def _get_commands():
# Django groupss commands by app.
# This returns static dict() as it is for django 1.8 and the default project.
commands = {
'changepassword': 'django.contrib.auth','check': 'django.core','clearsessions': 'django.contrib.sessions','collectstatic': 'django.contrib.staticfiles','compilemessages': 'django.core','createcachetable': 'django.core','createsuperuser': 'django.contrib.auth','dbshell': 'django.core','diffsettings': 'django.core','dumpdata': 'django.core','findstatic': 'django.contrib.staticfiles','flush': 'django.core','inspectdb': 'django.core','loaddata': 'django.core','makemessages': 'django.core','makemigrations': 'django.core','migrate': 'django.core','runfcgi': 'django.core','runserver': 'django.core','runserver_plus':'django_extensions','shell': 'django.core','showmigrations': 'django.core','sql': 'django.core','sqlall': 'django.core','sqlclear': 'django.core','sqlcustom': 'django.core','sqldropindexes': 'django.core','sqlflush': 'django.core','sqlindexes': 'django.core','sqlmigrate': 'django.core','sqlsequencereset': 'django.core','squashmigrations': 'django.core','startapp': 'django.core','startproject': 'django.core','syncdb': 'django.core','test': 'django.core','testserver': 'django.core','validate': 'django.core'
}
return commands
为Django项目创建可执行文件后。在这种情况下,“ runserver”运行顺利。 使用PyInstaller构建可执行文件后,无法使用'runserver_plus'命令。
ubuntu@ubuntu:~/executables$ ./dist/myproject/myproject runserver_plus
* Running on http://127.0.0.1:8000/ (Press CTRL+C to quit)
* Restarting with stat
UnkNown command: '/home/ubuntu/executables/dist/myproject/myproject'
Type 'myproject help' for usage.
ubuntu@ubuntu:~/executables$
执行后,
ubuntu@ubuntu:~/executables$ ./dist/myproject/myproject help
Type 'myproject help <subcommand>' for help on a specific subcommand.
Available subcommands:
[auth]
changepassword
createsuperuser
[django]
check
compilemessages
createcachetable
dbshell
diffsettings
dumpdata
flush
inspectdb
loaddata
makemessages
makemigrations
migrate
runfcgi
runserver
shell
showmigrations
sql
sqlall
sqlclear
sqlcustom
sqldropindexes
sqlflush
sqlindexes
sqlmigrate
sqlsequencereset
squashmigrations
startapp
startproject
syncdb
test
testserver
validate
[django_extensions]
runserver_plus
[sessions]
clearsessions
[sslserver]
runsslserver
[staticfiles]
collectstatic
findstatic
ubuntu@ubuntu:~/executables$
如何使用PyInstaller使用django-extensions库为django构建可执行文件?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。