Skip to main content
 首页 » 编程设计

python之dev_appserver.py 没有启动开发服务器

2025年05月04日2652php

我一直在按照这里的教程尝试在 Google 应用引擎上构建应用:

https://github.com/GoogleCloudPlatform/appengine-django-skeleton

虽然我遇到了障碍,但当我运行 dev_appserver.py 时,3 个服务器中有 2 个运行良好。但是开发服务器只返回 500 个错误。

确切的控制台输出如下:

ubuntu@ubuntu:~/Desktop/appengine-django-skeleton$ dev_appserver.py --port=9999 app.yaml 
INFO     2015-12-15 15:50:11,507 sdk_update_checker.py:229] Checking for updates to the SDK. 
INFO     2015-12-15 15:50:11,691 sdk_update_checker.py:257] The SDK is up to date. 
INFO     2015-12-15 15:50:11,807 api_server.py:205] Starting API server at: http://localhost:60930 
INFO     2015-12-15 15:50:11,993 dispatcher.py:197] Starting module "default" running at: http://localhost:9999 
INFO     2015-12-15 15:50:11,993 admin_server.py:116] Starting admin server at: http://localhost:8000 
ERROR    2015-12-15 15:50:16,395 wsgi.py:263]  
Traceback (most recent call last): 
  File "/home/ubuntu/Desktop/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle 
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler()) 
  File "/home/ubuntu/Desktop/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler 
    handler, path, err = LoadObject(self._handler) 
  File "/home/ubuntu/Desktop/google_appengine/google/appengine/runtime/wsgi.py", line 96, in LoadObject 
    __import__(cumulative_path) 
  File "/home/ubuntu/Desktop/appengine-django-skeleton/mysite/wsgi.py", line 29, in <module> 
    application = get_wsgi_application() 
  File "/home/ubuntu/Desktop/appengine-django-skeleton/lib/django/core/wsgi.py", line 13, in get_wsgi_application 
    django.setup() 
  File "/home/ubuntu/Desktop/appengine-django-skeleton/lib/django/__init__.py", line 18, in setup 
    apps.populate(settings.INSTALLED_APPS) 
  File "/home/ubuntu/Desktop/appengine-django-skeleton/lib/django/django/apps/registry.py", line 85, in populate 
    app_config = AppConfig.create(entry) 
  File "/home/ubuntu/Desktop/appengine-django-skeleton/lib/django/django/apps/config.py", line 131, in create 
    "'%s' isn't a subclass of AppConfig." % entry) 
ImproperlyConfigured: 'django.contrib.admin.apps.AdminConfig' isn't a subclass of AppConfig. 

我猜这里的关键是

ImproperlyConfigured: 'django.contrib.admin.apps.AdminConfig' isn't a subclass of AppConfig. 

github 上的文件没有任何代码更改。只有 github 页面上列出的配置更改。

请您参考如下方法:

我设法通过在 virtualenv 上安装所有需要的模块来解决这个问题,而不是在 lib 目录中。克隆存储库后,运行此命令。

pip install -r requirements.txt