I recently moved over to using Dokku and am wondering if someone can help me out with this. I am trying to run Vue and Django on a Linode server. Currently I have Django serving at my IP. Looks like in nginx, that port 80 is being listened to and Django is being served at /. I'd like to move Django to either be served at ':8000' as it is on my local machine or to be served at '/backend'. Then I'd like to serve Vue the way Django is currently being served () and it can hit the api at either previously mentioned Django location.
I ended up just throwing Vue up on netlify and that worked great.
Related
I deleted all the files and folders associated with the Wordpress site I intend to write from scratch using standard HTML, JavaScript, CSS and with Django framework. My question is if I can use this domain with this newly created site in a VPS.
At first I had erased the files and folders and recreated it with the Django app right onto the Wordpress structure, and that does not seem to be working. I am most likely doing something wrong anyways, but I am after the right way of accomplishing this.
Domain names are separate from web servers (such as your VPS), CMS (e.g. WordPress) or a framework (e.g. Django). So there is no problem using that same domain name for your new website with Django.
However, you'll need to reconfigure your VPS to run Django. Better if you reinstall your VPS with Django. Follow the guide provided by your VPS to install Django properly. This includes configuring the web server (e.g. Apache or Nginx), setting up a database, and properly linking your domain to the new server.
I have built an app using react and django. After deploying the app on heroku, when I open it the frontend works fine. However when i try to do any action that sends requests to the backend I get errors. The only time the requests work fine is when the django backend is running locally. I hsve been looking allover for solutions and have not been able to find any solutions. In my settings.py The heroku domain name is added to the allowed hosts
ALLOWED_HOSTS = ['127.0.0.1', 'localhost', 'barkbnb-demo.herokuapp.com']
If anyone can point me in the right direction on where to begin looking for solving the issue that would be greatly appreciated.
Thanks!
Check your request string in React app when you call your backend. It looks like it uses local address there.
I am planning to deploy an application which is built in react frontend, and calls a python backend. What I am planning is to deploy react on a linux box on a node.js server and python on django behind Apache.
Can someone would suggest if this would be right architecture from production grade perspective?
If application is expected to get 1000 requests per hour, then will this architecture work? or I should replace or add components or layers?
Generally, you run both servers on different ports, and then point apache to django server for /api/ calls (or whatever URLs need to go to django api), and then the rest of the regular requests you point at node.js serving your javascript frontend application.
1000 requests per hour seems like nothing - depending of course on the work of the backend server - but in general any webserver should handle that no problem.
Apache has following settings for this:
ProxyPass "/api" "http://127.0.0.1:8000/api"
ProxyPassReverse "/api" "http://127.0.0.1:8000/api"
You can read more in documentation here: https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html
I'm a complete newbie when it comes to sysadmin/deployment. Here's what I'm hoping to accomplish:
Have domain.com be a normal WordPress site.
Have either domain.com/app or app.domain.com be a Django webapp.
Hosting on Linode.
Quick and easy updates of the Django webapp code.
From what I can tell, gunicorn is an elegant way to serve the Django webapp, while WordPress fits most naturally with Apache. Meanwhile, nginx is recommended as a proxy in front of gunicorn and also seems to be used to improve performance of WordPress sites.
So what I'm thinking is: use nginx as a proxy server that routes all incoming web requests to either gunicorn (for the Django wepapp) or Apache (for the WordPress site). The Linode host would be running nginx, gunicorn, and Apache simultaneously.
Meanwhile, for updates of the Django webapp, I can simply update to the latest version of the code via github.
Does all that make sense? Am I even understanding things conceptually correctly? Or barking up the wrong tree entirely? (For instance can/should I just use a single Apache server to route requests to either WordPress or the Django app based on URL?) What gotchas and issues should I keep in mind as I research how to get this running nice and smoothly?
UPDATE: I've side-stepped all of this by (1) using Heroku to host my Django app, (2) using a CNAME record to map app.domain.com to the Heroku-hosted Django app, and (3) leaving (for now) the WordPress site on its existing host at domain.com. Thankfully, after gaining great new respect for what sysadmins and db admins do as I investigated all this, now I can get back to coding!
#Ghopper21
+1 for your question first.
Now, This is really interesting to know how it's possible in real time execution. I checked with some of my geek friends and I found tremendous response, here are some of suggestion with reference I got after brainstorming with them.
First of all check this link for deploying & running WP altogether with Django on Nginx +uWSGI...
These two threads of support forums from Webfaction.com gives you more idea about how they are recommending it to their client...
Deploying Django and Wordpress in same domain
wordpress + django on same account - advisable or not?
Hey, I got one support ref. of Stack Overflow itself, which is explaining how to achieve it on APACHE server...
How do I run Django and PHP together on one Apache server?
And last but not least, the one where a geek like us integrated WP with Django...
Integrate WordPress and Django
I have installed Django, Apache2 and even mod_wsgi. With a project, I have Django serving it. When i press the "http://localhost:8000" (which is django server) I have made sure that my websites main page or home page is shown.
The doubt i carry is, when i can do all this localhost:8000 and get the webpage, where does apache and mod_wsgi come into picture? I mean, why should i consider my files to be served by Apache2 when i have Django server? I just searched and came across facts that we have these facilities of apache+mod_wsgi to help us serve the site. But again, i m in confusion as in where is it used to serve my files when i have my website running on Django server?
Please if anyone can make me understand !!
Thank you
Short answer: The Django development server is a piece of poo.
Longer answer: The Django development server is a single-threaded, single-processed server that is little more than a threadbare WSGI server on a skeleton of hopes and wishes.
I used FastCGI.
As I have installed the Django site with FastCGI. I come to conclusion that, Apache has to serve the files, as Django is the development server and by itself can't serve the files online. It requires well known web server like Apache to serve the pages and do the things.
As when the request is sent to the server, the installed apache is used to serve the files and not Django as it has the ability to get the request and then use the files of the project to show online