Django and sqlite3

apostolos_ | Παρ, 12/05/2008 - 14:06 | 3' | 4

Ειπα λοιπόν να ξεκινήσω το django γιατί μ'αρέσει και η python.ξεκίνησα λοιπόν με το τουτόριαλ του περιοδικου σας.Το έστησα και έφτασα στην δημιουργία αντικεμένων για την κλάση....Ακολούθησα πιστά το τουτόριαλ και έγραψα αυτό στο models.py

from django.db import models

# Create your models here.

class Equipment(models.Model):
email = models.EmailField(max_length = 200,null= False)
manufacturer = models.CharField(max_length = 20, null = False)
model = models.CharField(max_length = 200, null = False)
serial = models.CharField(max_length = 200, null = False, db_index = True)
types = models.CharField(max_length = 1,choices = (('C', 'Camera'),('L','Lens'),('F','Flash'),('O','Other'))
date_created = models.DateTimeField(auto_now_add = True)
date_stolen = models.DateTimeField(blank = True, null = True)
def __unicode__(self):
return self.serial
όταν τρέχω python magane.py validate ή python manage.py sqlall edb(το app με την βάση μου) παίρνω αυτό
python manage.py validate
Traceback (most recent call last):
File "manage.py", line 11, in
execute_manager(settings)
File "/usr/lib/python2.5/site-packages/django/core/management/__init__.py", line 340, in execute_manager
utility.execute()
File "/usr/lib/python2.5/site-packages/django/core/management/__init__.py", line 295, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python2.5/site-packages/django/core/management/base.py", line 77, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/lib/python2.5/site-packages/django/core/management/base.py", line 96, in execute
output = self.handle(*args, **options)
File "/usr/lib/python2.5/site-packages/django/core/management/base.py", line 178, in handle
return self.handle_noargs(**options)
File "/usr/lib/python2.5/site-packages/django/core/management/commands/validate.py", line 9, in handle_noargs
self.validate(display_num_errors=True)
File "/usr/lib/python2.5/site-packages/django/core/management/base.py", line 122, in validate
num_errors = get_validation_errors(s, app)
File "/usr/lib/python2.5/site-packages/django/core/management/validation.py", line 28, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/usr/lib/python2.5/site-packages/django/db/models/loading.py", line 128, in get_app_errors
self._populate()
File "/usr/lib/python2.5/site-packages/django/db/models/loading.py", line 57, in _populate
self.load_app(app_name, True)
File "/usr/lib/python2.5/site-packages/django/db/models/loading.py", line 72, in load_app
mod = __import__(app_name, {}, {}, ['models'])
File "/home/avlah/django-projects/iwmcb/../iwmcb/edb/models.py", line 11
date_created = models.DateTimeField(auto_now_add = True)
^
SyntaxError: invalid syntax

ποιο είναι το πρόβλημα?

Φόρουμ
Δώσε αστέρια!
Σχόλια

Συνεχίζω εδώ!Εχω αυτό το urls.py
from django.conf.urls.defaults import *

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
# Example:
# (r'^iwmcb/', include('iwmcb.foo.urls')),

# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
#(r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
(r'^admin/(.*)', admin.site.root),

)
και όταν τρέχω τον server μου βγαζει το μήνυμα

Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/

Using the URLconf defined in iwmcb.urls, Django tried these URL patterns, in this order:

1. ^admin/

The current URL, , didn't match any of these.

αυτό το βγάζει όταν προσπαθήσω να μπώ στην σελίδα μου

Life is what you make it....So make it funky!!!

ok και αυτό. Απλά στο τουτόριαλ έλεγε ότι έπρεπε να γράψω σκέτη την διεύθυνση αλλα σε εμένα δούλεψε ως http://127.0.0.1:8000/admin

Life is what you make it....So make it funky!!!