After the django backend API is developed and deployed, how can the front-end code be deployed to the same server?

now after I use django restfulframework to write the back-end code and deploy it to the server through nginx+uwsgi, enter ip to display the API page. Now, after the front-end code is taken, how to deploy it and enter ip to display the home page instead of the API page.

Mar.15,2021

according to your description, it is a separate working mode, back-end api interface, front-end invocation. So you also need a server to deploy on your front end.
if your front end is a framework such as vue,angular, you can deploy it directly according to the official website documentation.


you are asking about the nginx configuration. Configure multiple server modules. If you want to use a domain name to point to the front-end and back-end respectively, the server_name configuration can be different; if you want to use the same IP, the listening port will be different. All of the above will have cross-domain problems, and you need to solve the cross-domain problems again.
if you want to use the same domain name or the same IP+ port, you need to configure different location, in a server to point to the front and back ends.

Menu