Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create sub-applications in Django?

Tags:

django

I'm a Django newbie, but fairly experienced at programming. I have a set of related applications that I'd like to group into a sub-application but can not figure out how to get manage.py to do this for me.

Ideally I'll end up with a structure like:

project/    app/        subapp1/        subapp2/ 

I've tried manage.py startapp app.subapp1 and manage.py startapp app/subapp1
but this tells me that / and . are invalid characters for app names.

I've tried changing into the app directory and running ../manage.py subapp1 but that makes supapp1 at the top level. NOTE, I'm not trying to directly make a stand-alone application. I'm trying to do all this from within a project.

like image 686
jamida Avatar asked May 19 '10 00:05

jamida


People also ask

Can we create app inside app in Django?

Django is famous for its unique and fully managed app structure. For every functionality, an app can be created like a completely independent module. This article will take you through how to create a basic app and add functionalities using that app.

What is the difference between project and app in Django?

A project refers to the entire application and all its parts. An app refers to a submodule of the project. It's self-sufficient and not intertwined with the other apps in the project such that, in theory, you could pick it up and plop it down into another project without any modification.


1 Answers

You can still do this :

cd app django-admin startapp subapp1 

This will work (create the application basic structure), however app and subapp1 will still be considered as two unrelated applications in the sense that you have to add both of them to INSTALLED_APPS in your settings.

Does this answer your question ? Otherwise you should tell more about what you are trying to do.

like image 150
sebpiq Avatar answered Sep 26 '22 01:09

sebpiq