Django url's apearence

31 views Asked by At

Consider the scenerio where, Iam creating a Django application where a user can SignUp and LogIn and do some stuff. So I created some functions like SignUp LogIn etc. in views.py file of the app. And I map it to corresponding urls in urls.py file. So while running locally, if I go to localhost:8000/SignUp the user will be taken to the SignUp page right! So my question is, how can I get the same thing done but the link be like SignUp/localhost:8000 ? Or simply how can I bring the mapped urls to the beginning of my localhost:8000 link? Is that possible in Django?

Sorry if my terminologies are bad... But I need to know this. ThankYou for reading.

1

There are 1 answers

3
LucasBorges-Santos On

in your url pattern you can made:

urlpatterns = [
    path('', include('your-app.urls', namespace='your-app-name')),
]

with a empty path.

In your urls.py from principal project folder:

urlpatterns = [
    path('', include('your-app.urls', namespace='your-app-name')),
]

And in your urls.py from app folder:

urlpatterns = [
    path('', views.YourAppView, name='your-view-app-name'),
]