Forums

Connecting Django APP to Django Projects, include functions/etc.

I created a Django program using python anywhere. I don't know how to properly connect my app to the project level app.

Here's an example:

This is my views.py file at the app.

from . import views from django.urls import path

urlpatterns = [ path('', views.PostList.as_view(), name='home'), path('<slug:slug>/', views.PostDetail.as_view(), name='post_detail'), ]


This is my project level:

from django.contrib import admin from django.urls import path, include

urlpatterns = [ path('admin/', admin.site.urls), path('blog/', include('myapp.urls')), ]


My settings has the app install as 'myapp', which is the name of my app. ''


When I run this code on VS Code, i get no problems.. On pythonanywhere, the link just doesn't appear.

Take a look at official django tutorial https://docs.djangoproject.com/en/4.2/intro/tutorial01/#write-your-first-view