You need a __init__.py in your models.py. You also need to import all your 
models into that __init__.py.

If I recall you'll also want to set

class Meta:
    app_label = "the name of your package"

Because the models directory will screw up Django's ability to auto figure it 
out.  


On Saturday, October 15, 2011 at 12:32 AM, Chen Xu wrote:

> I tried to delete models.py, and just have a /model subdirectory, but "pythin 
> manage.py syncdb" doesnt pick up the models in /models directory,
> Do i need to change some configurations to tell Django to use /models 
> subdirectory.
> Or do I need __init__.py in my /models subdirectory, I tried both, neither 
> works.
>  
>  
>  
> Thanks
>  
>  
>  
> On Fri, Oct 14, 2011 at 4:31 AM, Phang Mulianto <braveh...@gmail.com 
> (mailto:braveh...@gmail.com)> wrote:
> > maybe you can try remove the models.py coz by default syncdb look for 
> > models.py or anything beneath models folder...but cannot do both of them... 
> >  
> > On Oct 14, 2011 5:49 PM, "Chen Xu" <xuche...@gmail.com 
> > (mailto:xuche...@gmail.com)> wrote:
> > > and when i tried "python manage.py sqlall  <appname>"  it gives empty.
> > > I think is it because I am not importing  properly or something else is 
> > > going wrong.
> > >  
> > >  
> > > Thanks
> > >  
> > >  
> > >  
> > >  
> > >  
> > > On Fri, Oct 14, 2011 at 2:46 AM, Chen Xu <xuche...@gmail.com 
> > > (mailto:xuche...@gmail.com)> wrote:
> > > > I know that will work, but what I can do to just make "python manage.py 
> > > > syncdb" work?
> > > >  
> > > > Thanks very much
> > > >  
> > > >  
> > > > On Fri, Oct 14, 2011 at 2:37 AM, nicolas HERSOG <n.her...@gmail.com 
> > > > (mailto:n.her...@gmail.com)> wrote:
> > > > > You can also type python manage.py sqlall <yourApp> and copy paste 
> > > > > sql instructions in your bd
> > > > >  
> > > > > On Fri, Oct 14, 2011 at 11:23 AM, Chen Xu <xuche...@gmail.com 
> > > > > (mailto: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.
> > > > > >  
> > > > > > 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 
> > > > > > (mailto:django-users@googlegroups.com).
> > > > > > To unsubscribe from this group, send email to 
> > > > > > django-users+unsubscr...@googlegroups.com 
> > > > > > (mailto:django-users%2bunsubscr...@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 
> > > > > (mailto:django-users@googlegroups.com).
> > > > > To unsubscribe from this group, send email to 
> > > > > django-users+unsubscr...@googlegroups.com 
> > > > > (mailto:django-users%2bunsubscr...@googlegroups.com).
> > > > > For more options, visit this group at 
> > > > > http://groups.google.com/group/django-users?hl=en.
> > > >  
> > > >  
> > > >  
> > > > --  
> > > > ⚡ Chen Xu ⚡
> > >  
> > >  
> > >  
> > > --  
> > > ⚡ 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 
> > > (mailto:django-users@googlegroups.com).
> > > To unsubscribe from this group, send email to 
> > > django-users+unsubscr...@googlegroups.com 
> > > (mailto:django-users%2bunsubscr...@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 
> > (mailto:django-users@googlegroups.com).
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com 
> > (mailto:django-users%2bunsubscr...@googlegroups.com).
> > For more options, visit this group at 
> > http://groups.google.com/group/django-users?hl=en.
>  
>  
>  
> --  
> ⚡ 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 
> (mailto:django-users@googlegroups.com).
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com 
> (mailto: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