开发者社区 问答 正文

Django使用Gunicorn部署出错?报错

请教,今天使用gunicorn部署django应用出错,使用django自带的测试服务器没有报任何错误,但是使用gunicorn

gunicorn myapp.wsgi:application

每次执行这个都会报错

ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
<p>
	求教这是什么问题
</p>

展开
收起
爱吃鱼的程序员 2020-06-14 16:38:19 735 分享 版权
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    没有django环境变量啊,命令少了参数吧,直接用.py文件配置多方面可通过如下语句解决:export <spanstyle="font-family:Consolas,'BitstreamVeraSansMono','CourierNew',Courier,monospace;font-size:14px;line-height:15.3999996185303px;background-color:#FFFFFF;">DJANGO_SETTINGS_MODULE=myapp.settings

    2020-06-14 16:38:36
    赞同 展开评论