How to deploy mid sized Django App [closed] - django

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I just finished my Django App. All these months, I have been running the app on a local server using
python manage.py runserver
and it ran on 127.0.0.1 and was accessible only to my computer. Now that I am finished my app, I want it to be accessible to the world. I tried researching how to deploy my django app, and probably like most people in my situation, I am now completely lost. The words 'WSGI, AWS, WebFaction, Domain, Web hosting, Shared hosting, servers, VPS Vendor, RackSpace, Apache2 etc' are all flying around my head.
The first post I cam across was this one:
How to setup Django website in Amazon EC2 hosting?
The post says Amazon EC2 servers are good, but recommends WebFaction / Dreamhost instead. I decide to pick Amazon EC2 instead of WebFaction / DreamHost. I google about Amazon EC2, and then I find myself reading comparisons about AWS and VPS Vendors like RackSpace. I then agree to use Amazon EC2 instead of RackSpace. Then I thought to myself, where exactly do I buy the domain name from? I know that goDaddy is really popular for hosting domians so I look into that and I realize that godaddy doesn't support Django. I google'd which web hosting companies support Django, and I came across WebFaction again. So wait, I use WebFaction to register the domain and Amazon to host the site? I look at the prices for WebFaction and they give prices for bandwidth, disk space, server location etc. I google the price for AWS and they talk about the exact same thing: server location, space etc. At this point, I don't even know if WebFaction and AWS accomplish the same thing and if I am supposed to pick one or the other, or if WebFaction is for simply hosting the domain and AWS for the server? I then decide to research about servers, hoping to come across a post of how Amazon servers work and their relation with domain hosting sites. Instead, I find myself reading about Apache. Hm, so Apache is now another option? I google the relationship between the Apache server and AWS, and find that I can set up Apache on AWS? So do I need WebFaction, AWS and Apache to deploy my Django app?
I tried doing more research about deploying a Django app and came across a post talking about WSGI. It seems as if the more research I do, the more confused I get. So this is where I need your help:
The Django Application is basically a 'Blog' site which allows users to create accounts, upload images, comment and like images, follow other users, make posts (which consist of only text and images), comment on posts and like posts.
The Django Application is directed to an audience of about 1500 users (I'm estimating about 1500 users within the first two months). The application will be put up on the Android and iPhone app store as well (through WebView). My hostOS is windows 8 but I downloaded a VM (which runs Lubuntu) and did all my Django stuff in Lubuntu using Django 1.5, Python 2.7 and had to install PIL and Pillow as well. I used a PostgreSQL database. With all these details, how should I host my site?
I don't want to say 'Which servers should I use' because then some will say 'Amazon', some will say 'DreamHost', some might say 'Buy a domain and then user Amazon' and some might even start talking about WSGI and Apache to make me really confused.
What steps do I need to take to host my 1500 user application? Once the application hits 1500 users and starts going higher than that, then I will think about switching to a larger server, but for the first 1500 users, where should I buy the domain name and host the site? The site needs to be live within the next 3 weeks (so if a VPS vendor or Amazon EC2 is highly recommend, I can take out an entire week to learn about them). I just want to know if there is a more recommended, simpler solution rather than jumping right into a VPS vendor or buying a Domain and using Amazon EC2 server.
Edit: Should this go on ServerFault instead?

There are several layers here that you all need, but it can be confusing at first. To set up a Django site in a production environment, you're going to need:
Server hardware.
Webserver software.
Python connector (WSGI).
Registered domain name with DNS records.
A hosting service gives you access to server hardware. You rent a physical server or a virtual environment on a physical server. Most hosting platforms include domain name registration and managing DNS records, but some might require you to seek these services elsewhere.
In order for the server to actually serve a http response upon receiving a request, it has to run a webserver process. Apache and Nginx are such webservers. WSGI is the standard that allows webservers to communicate with Python applications. You'll need an implementation of this in order to connect to your Django application. Some choices are gunicorn, uWSGI and Apache's mod_wsgi.
With this information you should be able to understand most articles explaining how to deploy a Django application. Everything except the part about WSGI is also applicable to any other website, not just Django.

Related

What backend should I use to serve multiple websites, e.g. wordpress, web apps and mobile apps?

I am just starting to learn back end development, recently learned php and wordpress development, and I don't know what I should learn next.
The image below shows what I want to set up, and the software I think, but don't know if, I can use to achieve this.
Can I use a droplet on digitalocean and with django, nginx and uWSGI use that to host multiple static websites, wordpress websites and web apps. Can I also use the same server to communicate with mobile apps (created with flutter)?
Is this even possible, and what software do I need to use?
Pleas before asking any question google your question then ask.
There are no limits to the number of the services that you can host and deploy on your server or vps if you have enough resources on your machine.
To host a Web site or deploy a service there a lot of ways to do that, all you have to do is just google what ever you think you want to do, just google the question and the google will show you the path.

upload django site to the web hosting service

Hello im about the finish my first ever django website and I dont know how to upload it to the internet Bcuz I want to buy a web hosting service and to run django server I need to run a command python manage.py runserver and how is the web hosting service gonna do it? how should I upload my django website?
It's not easy to host a django project on a shared host. At least it come with a lot of problems that you have to face.
And you will need to use hostings that support a django project (Not only python). Django comes with requirements that not many hostings provide therefore i highly recommend to go with a VPS (Ubuntu for example) and host it yourself.
There is a lot of great docs for hosting a django project on a VPS and a lot of cloud services provide services for django.
Example:
How To Serve Django Applications with uWSGI and Nginx on Ubuntu 16.04
if you are fresher you need to create your on hosting service in your computer,
that is best idea for beginner,

Web Development Architecture (FOCUS: Database/CouchDB)

I had few questions that might be easy for others, but that I couldn't wrap my head around.
In developing a "PRODUCTION LEVEL" full-stack web application(node.js/react/webpack),
1) Where do you set up your database? (when developing, I'm using apache couchdb running on my localhost, but when deployed, is cloud database(cloudant) the only solution? or am i missing something?)
2) Is it recommended to deploy my server(node.js) to either digital ocean/aws/heroku, AND set up a third party database else where? (in my case, I'm have to use either Digital Ocean/Aliyun(Chinese Web Service), but they don't seem to have a database package that comes with couchDB) - What is the practical solution for production level application?
3) If cloud database is the practical solution, What Do I do if there is no database storage center for CouchDB located in China? is there a cloud database storage that universally saves all noSQL data regardless of your type of DB? (mongoDB, couchDB, etc.,)
4) AWS/Heroku provides add-ons where you can connect cloud database to my application, does this make the speed of my application faster? For Digital Ocean, it shows article about setting up CouchDB with their service, but does that mean that database will be available for my users to access? or is that just for development purposes
5) Where and How does "Docker" come in to play to help in my situation?
Sincerely,
I cannot say for CouchDB, but I have hosted multiple web applications on AWS using their RDS Database (MySQL). The service you choose (AWS/DO/Heroku), depends on your application and your requirements (pricing etc).
I don't think AWS has a package for MongoDB, but there is a third party service MongoLabs, which can host the MongoDB Database, I bet there would be some out there for CouchDB too.
Or if you cannot get a third party hosting, consider installing the database on your server itself. Getting a VPS from either DO or AWS and setting it up yourself could be an option in that case. The link you mentioned in your last paragraph would help you here. And yes, if you use that and let node connect to it, you can use it just like any other cloud based database, just that it would be on your server.
I haven't used Docker, so cannot say if and how that could help
UPDATE: (reply to comment)
A VPS is a server in the cloud. You don't set up the database on your local computer, no one can access that. You set up your database on the VPS (in the cloud) and then everyone can access that.
A VPS is like your own clean copy of server (ubuntu/fedora) in the cloud, so you can pretty much do anything on it, like your local computer. So basically your database would also be in the cloud.
There are actually 2 ways you could do that.
Get a VPS, install your database and set up your node.js server on the same VPS. Your node application would access the database on the same VPS.
Get a VPS specially for the database, and set up your node.js on another VPS, this would separate the database and node app on two different servers.
To answer part of your question... if you set up a CouchDB server on Digital Ocean (or on AWS, Azure, Google Cloud etc) it will be available to your production users, not just you. You will want to set up security/firewall to limit who can access your server of course.
Cloudant provide CouchDb as a service, in other words you would not have to install the software or manage a server.
With Digital Ocean/AWS/Azure/Google it is down to you to manage the virtual server and the database/other software on it. You can install CouchDb on any of these services and you can install both NodeJS and CouchDb on the same virtual server if you wish.
Bitnami have a CouchDb package that you can use to deploy CouchDb on to several of the major hosting companies, which makes the setup process easier.
I see that AWS and Azure have data centres in China, but at the moment Digital Ocean do not as far as I am aware. I hope this helps

how to create website using Django

I have one Django App. I want to get this app on World Wide Web.
Can anyone please help me with steps.
Like Some server addition(e.g. Apache or Nginx),Configuration of server,Integrating with Django,Web Hosting,etc.
Thanks
This at this link you will find a tutorial that helps you to deploy your app with NGINX
http://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html
simple and fast
In regards to hosting, you will have to get a domain name (unless you want to connect to your web page via IP address).
If you want to host your own web page from your server you will also have to set up your router to forward traffic to your server's IP. Having a static IP from your internet provider is preferable and also set your machine to have a static IP so you don't have problems with routing.
If you don't want the hassle of setting up a server environment all by yourself, you can also choose a PaaS provider like Heroku which supports Django applications out of the box. Hosting will cost more, but you will save time deploying your apps.

How to set up Apache server via an FTP account

I have developed a web application in Django and would like to go online i have an FTP access to the hosting server I am a beginner to "setting up a website" i would like to know how to install apache on that server and have my application working
Kindly provide detailed info as i am newbie, any links or tutorials would help a lot
Thanks in advance
If you only have user level access to the machine (ie: you don't have root), then you won't be able to control what web server runs and you can only control its settings to a limited regard. You will have to consider contacting your provider or looking for a different hosting package if the server doesn't meet you needs.
Typically, if it is a hosting server, the administrators will already have web server software like Apache running. You simply just have to upload what you would like to have displayed (typically to a directory called "public_html" or something like that), and it will display when someone visits your site. Hopefully they support things like Django, otherwise you might need to look at other options.
Your hosting provider is most likely to have specific and the most relevant instructions for how to upload your website.