gtalarico / django-vue-template

Django Rest + Vue JS Template
https://django-vue-template-demo.herokuapp.com/
MIT License
1.59k stars 406 forks source link

Fix dev server proxy to admin/rest_framework static assets #52

Open pawl opened 4 years ago

pawl commented 4 years ago

Visiting http://localhost:8080/api/admin will not load the django admin css. You'll get 404 errors on /static/admin/*. Same with the rest_framework styling when you visit an api endpoint through the browser.

This PR fixes the issue by telling the dev server to proxy requests to /static/admin and /static/rest_framework to django.

gtalarico commented 4 years ago

Did local host 8000 not work for admin?

pawl commented 4 years ago

Yes, :8000 works. It's kinda nice not needing to change ports though?

Maybe this line of the readme could be more clear?:

The Vue application will be served from localhost:8080 and the Django API and static files will be served from localhost:8000.

How about something like?: "The Vue application will be served from http://localhost:8080. To view http://localhost:8000/api/admin (Django Admin) or http://localhost:8000/api/messages (the api endpoint) with static files, you will need to visit the django server directly at http://localhost:8000."