Django - 如何将索引页面设置为 http://127.0.0.1:8000/
Dajngo - how set index page as http://127.0.0.1:8000/
我想在 Django 中设置一个指向我的 index.html 的 URL。
现在我可以在 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/
看到
这是我现在的 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)
这是我的应用/myapp/urls.py:
from django.urls import path
from . import views
app_name = "micromundos"
urlpatterns = [
path("", views.index, name="index"),
]
感谢任何帮助。谢谢
只需从 myapp/urls.py
:
中省略 path('', include("myapp.urls"))
中的 micromundos
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)
我想在 Django 中设置一个指向我的 index.html 的 URL。 现在我可以在 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/
看到这是我现在的 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)
这是我的应用/myapp/urls.py:
from django.urls import path
from . import views
app_name = "micromundos"
urlpatterns = [
path("", views.index, name="index"),
]
感谢任何帮助。谢谢
只需从 myapp/urls.py
:
path('', include("myapp.urls"))
中的 micromundos
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)