I have Flutter web and Django backend (REST API). I want to serve flutter web from Django directly. Every thing works fine if I start from domain (localhost:8000) and navigate to (localhost:8000/others) from web. But it shows 404 if I push URL (localhost:8000/others) direct from browser.
Note: On flutter only it works properly (used Navigator 2.0). But on integrating with Django its not working.
this is the error I get.
https://user-images.githubusercontent.com/47693882/122642537-a448d400-d12a-11eb-9dcb-592e1371066f.mp4
My Urls.py
This is the problem because of this, django server and flutter index.html both run on local with port 8000
you try upload index.html on a host
and also deploy django on another server
with this your problem maybe solved
Related
I have a background in Django and a some experience in Vue. I have used Vue for almost a year now, but since I need an SSR I have to use Nuxt.However, I am still very confused with how to deploy it in the server along with Django. Should I deploy them in the same server or should I deploy them in a different server with Django server for API and Nuxt for the front end?
I have also used Vue alongside Django for a while in my project and I'm looking into Nuxt right now.
I'm planning to migrate my standard Vue codebase into a Nuxt project.
The thing that I'm looking to do is to deploy Nuxt as a server target: 'server' (which is the default) alongside Django in Docker containers.
The idea is to be able to start the application with a simple docker-compose up.
I'm not done yet but you could look at it.
Typically, your docker-compose file would have 3 service :
The Django backend (API)
The Nuxt frontend (which make calls to the backend API)
Nginx which would route the traffic to Django or Nuxt according to your needs
EDIT BELOW :
Meanwhile, I changed my mind and instead of having Nuxt running as a server, I only have 2 containers :
The Django backend (API)
Nginx which serves my built Vue frontend and routes the traffic accordingly
I created front end in Reactjs and backend in Django and linked using Django rest API. but react runs in localhost:3000 and Django in localhost:8000. How to combine or integrate these two and runs in the same address.
Development
If you are in the development phase and using Create React App then you can add "proxy": "http://localhost:8000" to your package.json. Then your api requests done in React will be forwarded to port 8000.
Production
The production setup is quite different. You'll want to run yarn build and let either Django itself or nginx serve the index.html. In that case there won't be multiple ports anymore since the React build is just static files.
I am creating an example real world project as we speak with the same stack (GitHub). It doesn't have production setup quite ready yet, but you can see my development setup if you want some inspiration.
You need to link them using the routes you created in your backend. Put the routes in fetch requests in React frontend and call them via GET or POST methods etc. Your users will only hit the frontend host address once you deploy your application to the server.
I'm learning ReactJS and I already have experience with Django and DRF. My aim right now is to build a rather simple web application based on a Django backend and a ReactJS frontend. (Later on, when the web app is done, I'll tackle React Native).
I've been reading tons of documentation but nothing has sorted out the question:
What is the best approach to integrate a Django backend with a ReactJS frontend?
Should I keep them separate and connect them or should I mount ReactJS inside the Django application? Which one is the best-suited approach, taking into account maintenance and further development?
Thank you very much! Any opinion/hint will be appreciated.
My approach would be make an app called frontend or anything you like in Django, then all of my React code will be placed inside that app. You will also need webpack to bundle your React code then with collectstatic command Django will collect all the static files so it could be served. You can find the tutorial here
I have created a dynamic web page using HTML5 Css3 JS And django.
I have already bought a domain name.
Now i want to deploy my django project, but dont want to use any web host like heroku aws pythonanywhere etc.
All I could find on the web is how to configure apache and mod_wsgi to serve the files.
Is it possible to create a web hosting from my home ? If yes how ?
Using ubuntu server, apache & mod_wsgi or any other technology?
P.S. I dont want to use any web hosting company
So on your local computer you have to install webserver(apache, nginx or something else).
Then you have to specify a note of your domain name to your home ip address(it is better when you have static IP). If you will do this, all requests that will be in to your domain name will redirect to your home IP.
Then you have to configure your webserver.
I have a Facebook application hosted in Azure coded in c#. But configuration in my Facebook application asks for Hosting URL: that must be hosted in Heroku. So my application can't post actions to Facebook because this error always pops:
Given URL is not allowed by the Application configuration.
How is it supposed to work if I can't add my Azure URL: app.cloudapp.net as a hosting URL if only Heroku URLs are accepted.
Adding my applications's URL to the App Domains in application configuration hasn't helped either.
And strangely another application that I have works fine with no Hosting URL defined.
What I'm supposed to do to solve this, migrate everything to PHP? I know there can be another answer.