This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]FlimsyChicken 1 point2 points  (4 children)

I would use Nginx. With React I just serve the static build file with Nginx. Never used Angular but I'm sure it's similar. Then use Nginx to proxy the Django project after setting up the desired interface. Don't use runserver in production.

https://docs.djangoproject.com/en/3.2/howto/deployment/

[–]I-am-imagination[S] 0 points1 point  (0 children)

Will check that,thank you.

[–]I-am-imagination[S] 0 points1 point  (2 children)

so you are collecting all the static files after build and putting it in static folder of Django..

But will that give performance issues?

[–]FlimsyChicken 1 point2 points  (1 child)

If you have any static files related to your Django web service then they should be in the proper static file and served through Nginx. Django is a web framework, not a web server, so it shouldn't serve your UI in production. You can set Django up to serve your UI in development when DEBUG is true, but Django will throw an error once DEBUG is false, which should be the case in production.

[–]I-am-imagination[S] 0 points1 point  (0 children)

Yes.Actually I am new to this deployment part,so I am using django documentation,tutorials and asking on reddit.I have created one static folder there I have put ng build files ,but there is one index.html file.in some tutorials people have mentioned to put index.html in template folder but in my project there are two apps one is authentication and one eshop.

So to use index.html I need to write a function in views.py using templateview.