Combining django apps

64 перегляди
Перейти до першого непрочитаного повідомлення

Jun Tanaka

не прочитано,
18 жовт. 2022 р., 06:01:1518.10.22
Кому: Django users


mysite/

    manage.py

    config/

        __init__.py

        settings.py

        urls.py

        wsgi.py

    app1/

        app1a/

      app1b/

    app2/

    app3/


I would like to know how to combine  apps together just like above.  Each app itself  works fine when runserver. I followed some websites talking about this but I always get some error like ‘app1a' is not a registered namespace. I'm not very familiar with combining apps. I hope someone can tell me the simplest way to do that.

Thank you.

subin

не прочитано,
18 жовт. 2022 р., 13:09:0718.10.22
Кому: django...@googlegroups.com
Hi ! Thanks for making an appointment with us. We’re located at . We look forward to seeing you then!

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f4a91be8-c4a3-4fa1-9a73-bd202f1f6716n%40googlegroups.com.

Paulo Andrade

не прочитано,
19 жовт. 2022 р., 00:49:4119.10.22
Кому: Django users
First of all, you need to add all your apps in INSTALED APPS into the project > setings.py. I have 3 apps, core, members, and home. 

INSTALLED_APPS = [
  (..)
  'core',
  'members',
  'home',
 ]

Secondly, you need to create a route to each app in your project > urls.py

urlpatterns = [
  path(' ', include('home.urls')),
  path('udemy/', include('core.urls')),
  path('w3schools/', include('members.urls')),
  path('c-panel/', admin.site.urls),
 ]


After that, each app will be self-independent I  mean with your own models, templates, statics, etc. 

* Of course, you will need to run state collect and migrations commands on the terminal 
** make sure -->  ROOT_URLCONF = 'YOURPROJECT.urls' <-- project > setings.py

Let me show you an example 




subin

не прочитано,
19 жовт. 2022 р., 01:58:0819.10.22
Кому: django...@googlegroups.com
Please let me know if you need an extension.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

Jun Tanaka

не прочитано,
19 жовт. 2022 р., 03:04:2519.10.22
Кому: Django users

Thank you for your answer. I can not see below "Let me show you an example". Probably, some of last sentences got cutoff. And I want to see an example. 


2022年10月19日水曜日 13:49:41 UTC+9 eupaulo...@gmail.com:

Jun Tanaka

не прочитано,
19 жовт. 2022 р., 03:10:0519.10.22
Кому: Django users

Also, some website says something like

INSTALLED_APPS = [ 'todo.apps.TodoConfig', 

 

You say,

INSTALLED_APPS = [ 'todo', 

I am confused. Which is proper? And the difference?  


2022年10月19日水曜日 13:49:41 UTC+9 eupaulo...@gmail.com:
First of all, you need to add all your apps in INSTALED APPS into the project > setings.py. I have 3 apps, core, members, and home. 

ASAMOAH EMMANUEL

не прочитано,
20 жовт. 2022 р., 10:43:4120.10.22
Кому: django...@googlegroups.com
Register all your apps in the settings.py file and ensure the namespace is set to the app name in the urls.py in the project directory

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

Aziz Mek

не прочитано,
20 жовт. 2022 р., 12:10:5320.10.22
Кому: Django users
Hi,

Both are correct and lead to the same thing, however Django documentation seems to prefer  odo.apps.TodoConfig

I hope that helps

Kind regards
Aziz

Mohammed Mohamed

не прочитано,
21 жовт. 2022 р., 13:59:4121.10.22
Кому: Django users
Hello there, can we arrange Google meetings so that I can be able to learn from you? I'm a Python Beginner.

Dev Hs

не прочитано,
25 жовт. 2022 р., 13:30:2725.10.22
Кому: django...@googlegroups.com
When register app in config right all path to the app like 
“app1.app1a”
--
Відповісти всім
Відповісти автору
Переслати
0 нових повідомлень