【发布时间】:2018-05-30 19:36:34
【问题描述】:
我在 digitalocean 中创建了 Djnago 项目
。不幸的是,我在运行项目时遇到了问题
ImportError at / No module named urls
数字海洋
https://django-registration-redux.readthedocs.io
pip install django-registration-redux
文件 settings.py 添加
INSTALLED_APPS = (
'django.contrib.sites',
'registration', #should be immediately above 'django.contrib.admin'
'django.contrib.admin',
# ...other installed applications...
)
ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value.
REGISTRATION_AUTO_LOGIN = True # Automatically log the user in.
文件 urls.py 添加
url(r'^accounts/', include('registration.backends.default.urls')),
【问题讨论】:
-
不好意思问这个问题,你是不是在有urls.py的文件夹里放了一个init.py?
-
在公共站点上使用 runserver 或在公共站点上使用
DEBUG=True是不安全的。您正在使用 Django 1.8,它已经结束,不再接收安全更新。错误消息显示您正在使用导入from django.urls import path(需要 Django 2.0)和patterns(...)(自 2015 年 Django 1.8 以来已弃用)。我建议您至少升级到 Django 1.11 LTS,并确保您遵循的教程/书籍与您使用的 Django 版本相同。