P
P
popbus2016-01-23 13:00:53
React
popbus, 2016-01-23 13:00:53

How to set up a local server for development?

There is a backend on the Django Rest Framework, I started to make the client side for it using React + redux.
There were difficulties with accessing the api: the test servers of Django and the webpack I use are running on different ports - a problem with the Same Origin Policy.
With the help of Google, I realized that something like this is usually used: nginx as a proxy server, behind which are gunicorn, giving api, and nodejs, giving a js application. Node and python can be easily customized for each new project, but what about nginx? And in general, all this looks rather cumbersome for testing, maybe there are more suitable options?
I also read about Vagrant and Docker, is it worth bothering with any of them?
I hope I described the problem correctly, thanks in advance.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
P
pomeo, 2016-01-23
@popbus

Set up a webpack dev server and set the proxy address of your django in it, that's it.

T
Timur Shemsedinov, 2016-01-23
@MarcusAurelius

Well, you yourself have collected a full basket of unknown mushrooms, it is best to cook from mushrooms of the same variety that you know well. If everything is done on a node, then nothing more is needed, even nginx. By the way, even if you decide to collect all this (as almost everyone does, by the way), then be careful not to use the name localhost to access from the browser, there will be Same Origin Policy problems with it, use 127.0.0.1

D
Dimonchik, 2016-01-23
@dimonchik2013

with a vagrant and a docker, it's the fastest if you make prefabricated hodgepodges
, you can still set up a bunch of Nginx on different ports, and that's all

N
Nikita Gushchin, 2016-01-23
@iNikNik

Just set up CORS in your API. This is done everywhere in both PHP and JAVA. Usually the API server is on a different machine (with a different IP).
Google:
stackoverflow.com/questions/17931158/angularjs-dja...
www.django-rest-framework.org/topics/ajax-csrf-cors
https://github.com/tomchristie/django-rest-framewo.. .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question