Django React -- Deployment Error On Heroku (Page Not Found 404)
I'm deploying my Django React project to Heroku. Build was successful, but when I visit the site which is https://django-react-app-nba.herokuapp.com/, I'm getting django-react-app-nba.herokuapp.com/:14 GET https://django-react-app-nba.herokuapp.com/static/frontend/main.js net::ERR_ABORTED 404 (Not Found)
(Development for this project followed this tutorial https://www.valentinog.com/blog/drf/#Django_REST_with_React_Django_and_React_together)
ServerError (GET https://django-react-app-nba.herokuapp.com/static/frontend/main.js net::ERR_ABORTED 404 (Not Found))
I don't understand why Django is even looking for this URL, could anyone enlighten me?
My Project Files Path
nbavoting urls.py
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path("admin/", admin.site.urls),
path("", include("frontend.urls")),
path("", include("teams.urls")),
path("", include("users.urls")),
]
frontend urls.py
from django.urls import path
from . import views
urlpatterns = [path("", views.index)]
frontend views.py
from django.shortcuts import render
def index(request):
return render(request, 'frontend/index.html')
My guess to the problem is that the router in the frontend is conflicting with server-side routing? (I'm using HashRouter in React)
Answer
You forgot to run "npm run build" :D
Related Questions
- → Django, code inside <script> tag doesn't work in a template
- → Uncaught ReferenceError: Parent is not defined
- → React - Django webpack config with dynamic 'output'
- → Put a Rendered Django Template in Json along with some other items
- → Implement shopify templates in django
- → Python Shopify API output formatted datetime string in django template
- → How to avoid being crawled/penalized by Google
- → Django: Identify the urls that provide duplicate content and set a canonical link
- → Shopify app: adding a new shipping address via webhook
- → Jquery Modal Confirmation on Django form submit for deletion of object
- → changing the size of an image with css
- → shopify_auth multi store session handling
- → How to use Shopify Python API RecurringApplicationCharge