How can I serve an Angular app from root?

32 views
Skip to first unread message

Zayd Krunz

unread,
Feb 26, 2023, 3:23:12 PM2/26/23
to Django users
Hello,
I have a prebuilt Angular app, which is basically just static files. How can I serve it from the root project? If I set STATIC_URL to "/", I get the following:

django.core.exceptions.ImproperlyConfigured: runserver can't serve media if MEDIA_URL is within STATIC_URL.

Andréas Kühne

unread,
Feb 28, 2023, 6:59:27 AM2/28/23
to django...@googlegroups.com
Hi,

You shouldn't be serving your angular application that way. Running it in development, you run it and serve it from the "ng serve" command. Running in production, you need to have a webserver in front of your application any way, and should serve the angular files from the webserver.

Med vänliga hälsningar,

Andréas


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/60f7e50e-7900-46f1-a91e-67038ea91e30n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages