0
点赞
收藏
分享

微信扫一扫

Daphne 部署 Django ASGI 的常见错误与解决方法

禾木瞎写 2022-11-25 阅读 114

问题 1

django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

问题 2

django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. . You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

问题 3

127.0.0.1:61138 - - [11/Nov/2022:18:29:13] "GET /static/datatables-1.12.1/datatables.min-1.12.1.js" 404 2220

def return_static(request, path, insecure=True, **kwargs):
    return serve(request, path, insecure, **kwargs)


urlpatterns = [
    path('admin/', admin.site.urls),
    re_path(r'static/(?P<path>.*)$', return_static, name='static')

然后重启 Daphne,刷新页面就可以了

参考链接:https://www.cnblogs.com/hushuning/p/12152539.html

举报

相关推荐

0 条评论