Search code examples
pythondjangoherokuweb-deploymentdjango-urls

Dajngo - how set index page as http://127.0.0.1:8000/


I would like to set in Django a URL that will point to my index.html. Now I could see at http://127.0.0.1:8000/micromundos but I would like to configure the url to show micromundos at http://127.0.0.1:8000/

This is my current myapp/urls.py

from django.contrib import admin
from django.urls import path,include
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
path('admin/', admin.site.urls),
path('micromundos/', include("myapp.urls")),
       ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

This is myapp/myapp/urls.py:

from django.urls import path
from . import views

app_name = "micromundos"
urlpatterns = [
path("", views.index, name="index"),
]

Any help is appreciated. Thank you


Solution

  • Just omit micromundos in path('', include("myapp.urls")) from myapp/urls.py:

    from django.contrib import admin
    from django.urls import path,include
    from django.conf import settings
    from django.conf.urls.static import static
    
    urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include("myapp.urls")),
           ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)