Re: Directory structure issue.

2011-06-26 Thread Cal Leeming [Simplicity Media Ltd]
Also, check what your sys.path is. It could be that you actually need to do:

INSTALLED_APPS = (
'core.app1',
)

Or

('app1',)

Sometimes the path can get screwed up depending on the loading mechanism
used.

Cal
On 26 Jun 2011 14:11, "bruno desthuilliers" 
wrote:

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



Re: Directory structure issue.

2011-06-26 Thread bruno desthuilliers
On Jun 26, 12:18 am, 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
>
(snip)

> 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?*".

Add an empty __init__.py file in your "core" directory to make it a
python package  ("core.app1" looks for a subpackage "app1" in package
"core").

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



Re: Directory structure issue.

2011-06-26 Thread Mike Dewhirst

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.