On 26/06/2011 8:18am, Frederico Betting wrote:
Hi All

I am beginner in using django framework and I'm trying to do a project with a different directory structure but it's not working and I don't know what I am doing wrong.
Follow an example for what I am doing:

project
`-- core
    |-- app1
    |   |-- __init__.py
    |   `-- models
    |       |-- __init__.py
    |       |-- model01.py
    |       `-- model02.py
    `-- app2
        |-- __init__.py
        `-- models
            |-- __init__.py
            |-- model03.py
            `-- model04.py

As I've read in some tutorials, I've updated the __init__.py in models directory adding all the references contained on models files. For example, I updated the file project/core/app1/models/__init__.py adding all the model classes I had inside model01.py and model02.py. I also added a "class META" inside all the classes I have in my models like this: (example for app1)


*project/core/app1/models/__init__.py:*
/from modelFoo01 import */
/from modelFoo02 import */


*project/core/app1/models/model01.py*
/from django.db import models/
/

class foo01(models.Model):

         (...)
//
/

/
//
        class Meta:
//
                app_label = 'app1'


/
class foo02(models.Model):

         (...)
//
/

/
//
        class Meta:
//
                app_label = 'app1'

/
/
*
*
*
*
**project/core/app1/models/model02.py**
**/from django.db import models/**
**/
/**
**//
class foo03(models.Model):

         (...)
//
/

/
//
        class Meta:
//
                app_label = 'app1'


/
class foo04(models.Model):

         (...)
//
/

/
//
        class Meta:
//
                app_label = 'app1'

/
//**
/
/
In the settings.py file, I updated INSTALLED_APPS adding the values 'core.app1' and 'core.app2'. When I try to sync with DB, nothing happens. When I set the command "python manage.py sql core.app1" I get the message: "/Error: App with label core.app1 could not be found. Are you sure your INSTALLED_APPS setting is correct?/".

At first glance, my guess is that you should call them app1 and app2 if your settings.py file is in project/core.

Mike

I have already tried many different ways to make this thing works, but it doesn't work.
What is my mistake? Please, anyone could help me on this?

Thank you in advance.

Fred
--
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