问题描述
我正在尝试使用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 (将#修改为@)