이 튜토리얼에서 다른 오류가 있습니다. 나는 포기하고 다른쪽으로 나아갈 수 있어야합니까? 여기"실용적인 장고 프로젝트"로 붙어
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/
Django Version: 1.2.5
Python Version: 2.5.4
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'django.contrib.flatpages',
'cms.search',
'coltrane',
'tagging']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Traceback:
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/handlers/base.py" in get_response
91. request.path_info)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/urlresolvers.py" in resolve
215. for pattern in self.url_patterns:
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/urlresolvers.py" in _get_url_patterns
244. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/urlresolvers.py" in _get_urlconf_module
239. self._urlconf_module = import_module(self.urlconf_name)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/utils/importlib.py" in import_module
35. __import__(name)
Exception Type: SyntaxError at /admin/
Exception Value: invalid syntax (urls.py, line 6)
을 URL을 다음과 같습니다 : ... 어쨌든 .. 여기 간다
from django.conf.urls.defaults import *
from coltrane.models import Entry
entry_info_dict = {
'queryset': Entry.objects.all(),
'date_field': 'pub_date',
}
urlpatterns = patterns('django.views.generic.date_based',
(r'^$', 'archive_index', entry_info_dict, 'coltrane_entry_archive_index'),
(r'^(?P<year>\d{4})/$', 'archive_year', entry_info_dict, 'coltrane_entry_archive_year'),
(r'^(?P<year>\d{4})/(?P<month>\w{3})/$', 'archive_month', entry_info_dict, 'coltrane_entry_archive_month'),
(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$', 'archive_day', entry_info_dict, 'coltrane_entry_archive_day'),
(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', 'object_detail', entry_info_dict, 'coltrane_entry_detail'),
)
나는 오류가 entry_info_dict에 같아요. 어떤 도움이 필요합니까? 미리 감사드립니다.
import datetime
from django.conf import settings
from django.db import models
from django.contrib.auth.models import User
from tagging.fields import TagField
from markdown import markdown
import tagging
class Category(models.Model):
title = models.CharField(max_length=250, help_text='Maximum 250 characters.')
slug = models.SlugField(help_text="Suggested value automatically generated from title. Must be unique.")
description = models.TextField()
class Meta:
ordering = ['title']
verbose_name_plural = "Categories"
def __unicode__(self):
return self.title
@models.permalink
def get_absolute_url(self):
return ('coltrane_category_detail',(), { 'slug': self.slug })
class Entry(models.Model):
LIVE_STATUS = 1
DRAFT_STATUS = 2
HIDDEN_STATUS = 3
STATUS_CHOICES = (
(LIVE_STATUS, 'Live'),
(DRAFT_STATUS, 'Draft'),
(HIDDEN_STATUS, 'Hidden'),
)
# Core fields
title = models.CharField(max_length=250)
excerpt = models.TextField(blank=True)
body = models.TextField()
pub_date = models.DateTimeField(default=datetime.datetime.now)
# Metadata
author = models.ForeignKey(User)
enable_comments = models.BooleanField(default=True)
featured = models.BooleanField(default=False)
slug = models.SlugField(unique_for_date='pub_date')
status = models.IntegerField(choices=STATUS_CHOICES, default=LIVE_STATUS)
# Categorization
categories = models.ManyToManyField(Category)
tags = TagField()
# Fields to store generated HTML
excerpt_html = models.TextField(editable=False, blank=True)
body_html = models.TextField(editable=False, blank=True)
class Meta:
verbose_name_plural = "Entries"
ordering = ['-pub_date']
def save(self, force_insert=False, force_update=False):
self.body_html = markdown(self.body)
if self.excerpt:
self.excerpt_html = markdown(self.excerpt)
super(Entry, self).save(force_insert, force_update)
def __unicode__(self):
return self.title
@models.permalink
def get_absolute_url(self):
return ('coltrane_entry_detail',(), { 'year': self.pub_date_strftime("%Y"), 'month': self.pub_date_strftime("%b").lower(), 'day': self.pub_date.strftime("%d"), 'slug': self.slug })
여기
from django.conf.urls.defaults import *
from django.contrib import admin
import settings
admin.autodiscover()
from coltrane.models. import Entry
urlpatterns = patterns('',
# Example:
# (r'^cms/', include('cms.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
(r'^admin/', include(admin.site.urls)),
(r'^search/$', 'cms.search.views.search'),
(r'tiny_mce/(?P<path>.*)$', 'django.views.static.serve', { 'document_root': '/Users/danielcorreia/Sites/tinymce/jscripts/tiny_mce' }),
(r'^weblog/', include('coltrane.urls')),
(r'', include('django.contrib.flatpages.urls')),
)
models.py를 붙여 넣을 수 있습니까? –
예. 희망이 도움이됩니다. – danielcorreia
모델에 "라이브"관리자가 있습니까? –