Launching a Mezzanine site live - django

I'm new to mezzanine and Django. I have set up a site, everything is working but I can only launch the server on "development". I would like to access de site on the port 80 on the internet instead of internally, as I have no way other than redirecting the port via SSH to access it. I would like to know how to do that.
And another question, is Nginx included with Mezzanine automatically ? Cause I have a tuned up Nginx server there and I'm not sure what I need to do, if run it with my existing Nginx server or with the one included with Django if that is how it works .... thank you for bring some light on this.

NGINX is not included with Mezzanine, it's an entirely separate piece of software, similar to Apache.
Mezzanine includes a fabric script which can automatically set up a production server if you'd like to use it, and will install NGINX on the server for you, among many other things.
Given your question, I can't recommend enough that you read and understand all the related documentation on this topic. Start with the Mezzanine link below, it references many other documentation sites - Django, Fabric, NGINX, plus more.
Enjoy the adventure: http://mezzanine.jupo.org/docs/deployment.html

Related

Is Django Apache or Nginx

I have made a project in the framework Django and I am setting up SSL encryption so it gets https instead of http and removes the safety sign in browsers. In the installation process of Certbot I am asked which software it is running. Django is sadly not an option. I've heard that Django often gets under the category Apache or Nginx, but I am not sure which one my Django project is.
It is an Ubuntu server.
https://certbot.eff.org/
https://letsencrypt.org/getting-started/#with-shell-access
The answer is any of them. I believe you have 2 options, install certbot-django or stop django server and let certbot to create a certificate for you, and then adapt it to django appropriately.
Django is neither.
Apache or Nginx is the web server that will serve your Django application - Django has no bearing or opinion on that.
You just need to figure our which webserver you're using and go from there. If you haven't already set up the webserver then you'll need to pick one and follow a tutorial to set it up.
For example, here's how to set up Nginx with Django. But please do your own research on which one is best for you and your situation. An alternative to both could be Caddy for example.

Django hosting on a domain

So far, the only websites I've put in a hosted domain were with PHP. But since I work with Django I wonder if there would be any "barrier" or trouble when it comes about hosting a project, since Linux and IOS have Python installed by default but Windows not. Also it would be necessary to install tools such as Django itself, pillow, mysqlclient, etc...
I just want to know any possible barrier before going ahead. Thanks!
Everything depends on the server, if you have the necessary permissions to install and configure everything, you will not have any problem. How can be gunicorn, supervisor, nginx, etc.
For example services that you will not have any problem can be Amazon EC2, digitalocean, or any similar provider.
When I started with Django about 4 years ago I didn't know anything about servers, nginx and very little about databases but I found Djangoeurope on which I put my first websites.
They have managed databases (PostgreSQL and MySQL), one-click Django installs, reasonable prices and a very helpful staff.
I've since transitioned to using Docker on GCP, but for a beginner I can't recommend them enough: you can just concentrate on your Django code and you don't have to learn everything else at the same time.

How to deploy a WordPress site and Django site on the same domain?

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

Modifying existing Django site

I am completely new to this Django world. I haven't tried it ever before.
Now the problem is as below;
One of my clients was hosting his site somewhere else that I don't know and they built the site using Django. The host company doesn't allow to make any changes on their server, instead they provided the zip file for all the files in the site to me; so that now I can host my client's site.
As I don't know anything about Django, can someone please shed a light where I should start from?
Thanks in advance.
Cheers.
Sach
First of all, install Django on the development machine. Start by trying to get the development server run on your machine.
Gather requirements: check the settings.py for installed apps against the default Django settings.py file. See if there are any popular django apps that site depends on. If there are any, then you probably will have to install them, too.
In which format was the database provided? Will you move to another more appropriate format? Python bindings for databases are required too.
Considering the fact that you have inherited this project and probably will need to make some changes, consider installing django-south, so you can easily make changes to the database schema.
If you get the site running properly on your own machine, consider deplyoment. Is there a lot of static content? (if so, consider nginx). Set up apache2 and install the mod_wsgi module. Deploy.
Work your way through the Django tutorial first. Then look into Django Book as has been mentioned. Django IRC channel (#django) on Freenode is also great for help.
Your best bet would be to learn about Django before trying to jump in head first - https://www.djangoproject.com/ contains documentation as well as tutorials on creating Django apps.
Django is fairly easy to setup if you already have the code written. You'll need to install the chosen database and then simply follow the tutorial on the Django website
Django comes with a built-in server so it's very easy to run the website for development without needing Apache, nginx or much else.
I learned using the Django Book. Django is an easy-to-use framework, you should be fine.
Also, in the short-term there's a file called views.py and separate folder containing templates. If you're familiar with MVC (MVT in Django) this contains the views for the site in function form. There's probably (but not always) a folder for templates which contains a lot of the HTML for the site. Just a good starting pointing for basic modifications.
You can perhaps start here. https://docs.djangoproject.com/en/dev/howto/deployment/
First, find out the django version required by your client. Install that on a server (not a production one), setup apache and mod_wsgi. The zip files may go to a dir which can be included in the mod_wsgi configuration.
Find about the static files and setup apache or any other lightweight webserver to server it.
You may not be a developer, but have a try with the django book. It can give you a good idea how its structured.

How can I get django project run in https? and what actually is 'https'?

apache + python + mod_wsgi + django +svn:
I have alreaady get my django project running under http://. Then My boss ask me to get it run in https.
I would like to know what is the difference between http and https? And how can I make my django project run under https?
Thanks
`Oh sorry, I think I have to correct somethings here.
I got my boss wrongly. In fact, he wanted me to build and run django project with svn on apache server and he also wanted it running under https.
So, can anyone tell me or provide me some link of related information of how to setup these? (actually I have very little knowledge about what svn is doing. I think my boss wanted to use svn for managing the website source code.)`
*If possible, please tell more about svn. Thanks!
The Apache documentation has various documentation about HTTPS and setting it up to use it.
http://httpd.apache.org/docs/2.2/ssl/
You just need to put your mod_wsgi configuration within a VirtualHost setup for HTTPS.