Code Monkey home page Code Monkey logo

Comments (7)

GabrielDumbrava avatar GabrielDumbrava commented on August 16, 2024 70

Can you provide a code example? Because as I'm typing app_name="sth" in urls.py it doesn't work.

Let's say in your main urls.py you want to include the urls of an app, called shop_app, like this:
path("shop/", include("shop_app.urls", namespace='shop')),

Then, in your urls.py file of your shop_app located in shop_app/urls.py, after the urlpatters add the app_name like this:

urlpatterns = [
   ... some patterns
]

app_name = 'shop'

If you don't have access to the shop_app urls, as in case you are using an included package, then you'll have to drop the namespace from your main include and remove the namespace references from your url tags, or from your reverse functions.

from deux.

DonExo avatar DonExo commented on August 16, 2024 54

Or you can also use it this way:

path('mfa/', include(("deux.urls", 'app_name'), namespace="mfa")),

from deux.

VirtualKley avatar VirtualKley commented on August 16, 2024 5

Use app_name='nameapp'
in urls for applications, after urlpatterns

from deux.

Gathiira avatar Gathiira commented on August 16, 2024 4

as indicated by @DonExo

path('', include(('blog.urls', 'blog'), namespace='blog'))

from deux.

amontecino avatar amontecino commented on August 16, 2024 2

Excelent ¡¡¡

from deux.

gonzaloamadio avatar gonzaloamadio commented on August 16, 2024

with which value?

from deux.

rozacek avatar rozacek commented on August 16, 2024

Can you provide a code example? Because as I'm typing app_name="sth" in urls.py it doesn't work.

from deux.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.