Re: How to create a sub-app directly

2011-08-22 Thread kenneth gonsalves
On Mon, 2011-08-22 at 00:57 -0700, i...@webbricks.co.uk wrote:
> which is fine, but you've missed the only step that actually makes the
> folder a python module.
> 
> do this or it'll never import
> touch __init__.py 

got distracted and pressed send too soon.
-- 
regards
Kenneth Gonsalves

-- 
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: How to create a sub-app directly

2011-08-22 Thread i...@webbricks.co.uk
which is fine, but you've missed the only step that actually makes the
folder a python module.

do this or it'll never import
touch __init__.py



On Aug 22, 8:32 am, kenneth gonsalves  wrote:
> On Sun, 2011-08-21 at 08:22 -0700, Jim wrote:
>
> > Here is the story. I created a site, mysite, with this command
> > django-admin startproject mysite. Then, under the directory mysite/, I
> > created an app named apps with this command ./manage.py startapp apps.
> > apps is meant to hold all applications for mysite. Now, here comes the
> > question:  How do I create a sub-app under apps with manage.py
> > directly?
>
> one way to do this:
> cd apps
> mkdir subapp
> cd subapp
> touch models.py
> touch views.py
> touch tests.py
>
> --
> regards
> Kenneth Gonsalves

-- 
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: How to create a sub-app directly

2011-08-22 Thread kenneth gonsalves
On Sun, 2011-08-21 at 08:22 -0700, Jim wrote:
> 
> Here is the story. I created a site, mysite, with this command
> django-admin startproject mysite. Then, under the directory mysite/, I
> created an app named apps with this command ./manage.py startapp apps.
> apps is meant to hold all applications for mysite. Now, here comes the
> question:  How do I create a sub-app under apps with manage.py
> directly? 

one way to do this:
cd apps
mkdir subapp
cd subapp
touch models.py
touch views.py
touch tests.py

-- 
regards
Kenneth Gonsalves

-- 
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: How to create a sub-app directly

2011-08-21 Thread Jim
Thank you, folks. I am new to django. I read  a blog the other day that 
suggests put all applications under a common directory, such as apps, to 
make the site directory neat, and I think that seems a good idea. That's why 
I thought it would be wonderful if manage.py could make an app under a given 
directory, which is apps/ in my case. 

Anyway, it is always nice to hear other people's ideas. Again, thank you 
very much.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/khnbRq_8r1EJ.
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: How to create a sub-app directly

2011-08-21 Thread Mike Dewhirst

On 22/08/2011 1:22am, Jim wrote:

I tried
../manage.py startapp someapp
under apps/, but that created the someapp under mysite/ rather than 
under apps/.




That's what is expected.

mysite should contain settings.py and mysite/apps should contain 
models.py (among other files). If you want a separate database to 
contain data used by all applications there is nothing wrong with 
creating a new subdirectory mysite/common (someone here felt that 
"global" might be a reserved word) and copying the contents of 
mysite/apps into mysite/common. Then in settings.py put mysite.apps and 
mysite.common into INSTALLED_APPS.


I would adjust the name "apps" to something more specific for a single 
app. You can have a dozen app directories under mysite if you like. In 
fact that is good. Segregate your project into as many stand-alone apps 
as you feel comfortable doing - but they should all be at the same level 
for keystroke minimisation when importing.


 mysite (settings.py, urls.py etc)
  app1 (models.py, urls.py etc)
  app2 (urls.py)
   models (whatever.py containing just the whatever model)
  app3(models.py)
   urls (this.py containing just the this urls)
   views (lots of files keeping your views under control)

Because you import the bits and pieces as required it is best to keep 
things as flat as dictated by the inherent complexity of your project. 
In the diagram above, app1 is fairly simple, app2 has many complex 
models so you put them into separate files in a models sub-dir, while 
app3 has simple models but lots of complex urls which would be best in a 
separate urls directory and likewise for app3's views.


hth

Mike

--
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: How to create a sub-app directly

2011-08-21 Thread Subhranath Chunder
>From what I understood, by "sub-apps" Jim meant creating the application in
a sub-directory, or more specifically maybe inside another python package,
using the manage.py command for the sake of convenience and creating using a
single command.


On Sun, Aug 21, 2011 at 10:13 PM, Praveen Krishna R <
rpraveenkris...@gmail.com> wrote:

> *Is there  a concept of sub-apps exist in Django !?*
> *I knew some concepts like independant reusable apps.*
> *You can easily handle the rest with your urls right ?! correct me?
> *
>
> On Sun, Aug 21, 2011 at 6:27 PM, Subhranath Chunder 
> wrote:
>
>> Extend the manage.py functionality, by adding your custom command.
>> https://docs.djangoproject.com/en/dev/howto/custom-management-commands/
>>
>>
>> On Sun, Aug 21, 2011 at 8:52 PM, Jim  wrote:
>>
>>> Hello folks,
>>>
>>> Here is the story. I created a site, mysite, with this command django-admin
>>> startproject mysite. Then, under the directory mysite/, I created an app
>>> named apps with this command ./manage.py startapp apps. apps is meant to
>>> hold all applications for mysite. Now, here comes the question:
>>> *How do I create a sub-app under apps with manage.py directly?*
>>>
>>> I tried
>>> ../manage.py startapp someapp
>>> under apps/, but that created the someapp under mysite/ rather than under
>>> apps/.
>>>
>>> I also tried
>>> ./manage.py startapp apps/someapp
>>> and
>>> ./manage.py startapp apps.someapp
>>> under mysite/, but neither worked.
>>>
>>> So, my current work-around is to create a sub-app under mysite/ first,
>>> then move it into apps/ manually. But that seems dumb, and I suspect there
>>> is a simpler way to do this.
>>>
>>> Thanks for reading this. Any help is certainly appreciated.
>>>
>>> Jim
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msg/django-users/-/QtvEmvU5QvMJ.
>>> 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.
>>>
>>
>>
>>
>> --
>> Thanks,
>> Subhranath Chunder.
>> www.subhranath.com
>>
>>  --
>> 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.
>>
>
>
>
> --
> Thanks and Regards,
> *Praveen Krishna R*
>
>  --
> 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.
>



-- 
Thanks,
Subhranath Chunder.
www.subhranath.com

-- 
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: How to create a sub-app directly

2011-08-21 Thread Praveen Krishna R
*Is there  a concept of sub-apps exist in Django !?*
*I knew some concepts like independant reusable apps.*
*You can easily handle the rest with your urls right ?! correct me?
*
On Sun, Aug 21, 2011 at 6:27 PM, Subhranath Chunder wrote:

> Extend the manage.py functionality, by adding your custom command.
> https://docs.djangoproject.com/en/dev/howto/custom-management-commands/
>
>
> On Sun, Aug 21, 2011 at 8:52 PM, Jim  wrote:
>
>> Hello folks,
>>
>> Here is the story. I created a site, mysite, with this command django-admin
>> startproject mysite. Then, under the directory mysite/, I created an app
>> named apps with this command ./manage.py startapp apps. apps is meant to
>> hold all applications for mysite. Now, here comes the question:
>> *How do I create a sub-app under apps with manage.py directly?*
>>
>> I tried
>> ../manage.py startapp someapp
>> under apps/, but that created the someapp under mysite/ rather than under
>> apps/.
>>
>> I also tried
>> ./manage.py startapp apps/someapp
>> and
>> ./manage.py startapp apps.someapp
>> under mysite/, but neither worked.
>>
>> So, my current work-around is to create a sub-app under mysite/ first,
>> then move it into apps/ manually. But that seems dumb, and I suspect there
>> is a simpler way to do this.
>>
>> Thanks for reading this. Any help is certainly appreciated.
>>
>> Jim
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/django-users/-/QtvEmvU5QvMJ.
>> 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.
>>
>
>
>
> --
> Thanks,
> Subhranath Chunder.
> www.subhranath.com
>
>  --
> 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.
>



-- 
Thanks and Regards,
*Praveen Krishna R*

-- 
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: How to create a sub-app directly

2011-08-21 Thread Subhranath Chunder
Extend the manage.py functionality, by adding your custom command.
https://docs.djangoproject.com/en/dev/howto/custom-management-commands/


On Sun, Aug 21, 2011 at 8:52 PM, Jim  wrote:

> Hello folks,
>
> Here is the story. I created a site, mysite, with this command django-admin
> startproject mysite. Then, under the directory mysite/, I created an app
> named apps with this command ./manage.py startapp apps. apps is meant to
> hold all applications for mysite. Now, here comes the question:
> *How do I create a sub-app under apps with manage.py directly?*
>
> I tried
> ../manage.py startapp someapp
> under apps/, but that created the someapp under mysite/ rather than under
> apps/.
>
> I also tried
> ./manage.py startapp apps/someapp
> and
> ./manage.py startapp apps.someapp
> under mysite/, but neither worked.
>
> So, my current work-around is to create a sub-app under mysite/ first, then
> move it into apps/ manually. But that seems dumb, and I suspect there is a
> simpler way to do this.
>
> Thanks for reading this. Any help is certainly appreciated.
>
> Jim
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/QtvEmvU5QvMJ.
> 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.
>



-- 
Thanks,
Subhranath Chunder.
www.subhranath.com

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



How to create a sub-app directly

2011-08-21 Thread Jim
Hello folks,

Here is the story. I created a site, mysite, with this command django-admin 
startproject mysite. Then, under the directory mysite/, I created an app 
named apps with this command ./manage.py startapp apps. apps is meant to 
hold all applications for mysite. Now, here comes the question: 
*How do I create a sub-app under apps with manage.py directly?*

I tried 
../manage.py startapp someapp 
under apps/, but that created the someapp under mysite/ rather than under 
apps/. 

I also tried 
./manage.py startapp apps/someapp 
and 
./manage.py startapp apps.someapp
under mysite/, but neither worked.

So, my current work-around is to create a sub-app under mysite/ first, then 
move it into apps/ manually. But that seems dumb, and I suspect there is a 
simpler way to do this. 

Thanks for reading this. Any help is certainly appreciated.

Jim

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/QtvEmvU5QvMJ.
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.