On 14/10/2011, at 8:23 PM, Chen Xu <xuche...@gmail.com> wrote:

> Hi, 
> I am new to Django.
> I have installed Django and go t everything set up correctly, just started 
> some easy tutorials.
> 
> So when I do 
> Django-admin.py startapp  blog
> 
> 
> it creates a /blog directory that looks like thsi
> /blog
>     - __init__.py
>     - tests.py
>     - models.py
>     - views.py
> 
> I know in Django, when you run "python manage.py syncdb", it will look 
> through models.py, and create all the table it finds.
> However, I dont want to create all my tables in models.py, becaue when my 
> proj get bigger, it is hard to maintain.
> Therefore, I create a subdirectory "/Models" to store all my model
> 
> /blog
>     - __init__.py
>     - tests.py
>     - models.py
>     - views.py
>     /Models
>         - __init__.py
>         post.py
> 
>  so in my  
> models.py: (only 2 lines)
> from django.db import models
> from blog.Models import post
>     
> in my post.py: (only 3 lines)
> from django.db import models
> class post(models.Model):
>   body = models.TextField()
> 
> 
> and then when I run "python manage.py syncdb" , it doesn't create the table 
> "post" for me.

I would start with a tried and successful approach and *after* getting the 
tables created refactor the models into separate files if that seemed to be a 
good idea at the time. 

Also my guess is that you will eventually split your project into apps as a 
more "natural" way to keep things simple rather than putting individual models 
into their own files. 

However it may be possible to simply delete your models.py file to get syncdb 
to work. I haven't tried it so I don't know. 

Mike

> 
> Could anyone please help?
> 
> 
> 
> 
> Thanks very much
> Best regards
> 
> 
> -- 
> ⚡ Chen Xu ⚡
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to