0

我正在尝试在我的项目中使用 django-registration 包作为 APP。我所做的只是

  1. 从“”下载包
  2. 复制 SOWL 下的“注册”文件夹
  3. 在我项目的 URLs.py 中添加

    (r'^accounts/', include('registration.backends.default.urls')),
    
  4. 在我项目的 settings.py 中添加了“注册”

    INSTALLED_APPS = (
        'django.contrib.auth',
        'django.contrib.contenttypes',
        'django.contrib.sessions',
        'django.contrib.sites',
        'django.contrib.messages',
        'django.contrib.staticfiles',
        'CATALOG',
        'SOWLAPP',
        'registration',
        # Uncomment the next line to enable the admin:
        'django.contrib.admin',
        # Uncomment the next line to enable admin documentation:
        'django.contrib.admindocs',
    )
    

它给出了以下错误 -

C:\SHIYAM\Personal\SuccessOwl\SOWL0.1\SOWL>python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
443, in execute_from_command_line
    utility.execute()
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 196,
 in run_from_argv
    self.execute(*args, **options.__dict__)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 217,
 in execute
    translation.activate('en-us')
  File "C:\Python27\lib\site-packages\django\utils\translation\__init__.py", lin
e 105, in activate
    return _trans.activate(language)
  File "C:\Python27\lib\site-packages\django\utils\translation\trans_real.py", l
ine 194, in activate
    _active.value = translation(language)
  File "C:\Python27\lib\site-packages\django\utils\translation\trans_real.py", l
ine 183, in translation
    default_translation = _fetch(settings.LANGUAGE_CODE)
  File "C:\Python27\lib\site-packages\django\utils\translation\trans_real.py", l
ine 160, in _fetch
    app = import_module(appname)
  File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 35, in im
port_module
    __import__(name)
  File "C:\SHIYAM\Personal\SuccessOwl\SOWL0.1\SOWL\registration\__init__.py", li
ne 3
    <!DOCTYPE html>
    ^
SyntaxError: invalid syntax

C:\SHIYAM\Personal\SuccessOwl\SOWL0.1\SOWL>

我正在查看注册包中的urls.py__init__.py它们看起来都与我项目下的常规应用程序中urls.py的通常不同。__init__.py为什么它们不同,我应该怎么做才能使它不同?

  • SHM
4

1 回答 1

0

您在复制注册应用程序时似乎出了点问题。回溯表明__init__.py包含 html like <!DOCTYPE html>,它绝对不应该。

于 2012-08-11T14:31:43.143 回答