How to host Django website using cPanel? - django

I am new to the world of website hosting, especially in cPanel platform. I have a website which is developed using Python language, which makes use of Django also. I have hosted this website in cPanel. But it doesn't seems to be working.
When I browse my website domain (www.def.com), now it displays site.wsgi (wsgi file) file as such.
I could know that by default, CPanel doesn't support Django. Using SSH, I have installed Django. But I am not sure how to configure the same. Would be good if I can get a step by step instructions on how to install and configure Django in cPanel.
FYI, This is a shared web hosting server from GoDaddy and that too not a virtual Private server or doesn't have root access. How will host this site by using wsgi file.

Although it seems CPanel does not support Django apps "out of the box", google results lead me to believe it might be possible using a more manual method.
Additionally, CPanel has this plugin for Django/python installation
Please note that I have not tried any of the above, but the latter seems more promising since it has been updated more recently (2015, as opposed to the 2011 blog entry).

Related

Will I be able to use a wordpress site domain as a django website on a VPS?

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.

Deploying Django on IIS and ngrok

I am trying to deploy Django on local host and "tunnel" using ngrok. The ngrok works but the IIS (Internet Information Manager) gives 500 Error <handler> scriptProcessor could not be found in <fastCGI> application configuration. Reference into fastcgi shows that this feature is deprecated but what is the replacement for serving Django using local server and ngrok. I also pip installed pyngrok. Can you suggest a clear solution?
FastCGI was deprecated in Django 6+ years ago, their docs say WSGI is the preferred alternative, and they provide a tutorial for types of WSGI deployments to get you started.
But you wouldn't use ngrok in this case, you'd serve it up with something like nginx or apache using a wsgi mod (also shown in their tutorial). Where you'd use ngrok is in development with Django's built-in dev server, and that's the full example provided in pyngrok's documentation.
Usually I'd provide actual sample code here, but what you're asking about are full end-to-end solutions, which is why I'm providing links. Without the full context and examples of what you've built, it's hard to tell you where it's going wrong—hard to provide specific solutions without specific examples of the problem. But these tutorials tutorials are for exactly what you're doing, so hopefully they can help you debug your own solution.

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.

Deploy simple PHP website to Swisscom Application Cloud: how to configure the server?

I am trying to deploy a simple PHP website to the Swisscom Application Cloud, based on cloud foundry.
My website is working fine locally, served by Apache.
I have followed the tutorial, but I am not clear on some aspects.
In the tutorial, the way to check if the app is working normally is to run it in the built-in web server in php through php -S. This doesn't work for me because my website has html extensions for php files and these are not interpreted correctly by the built-in server. In Apache, I can configure that just fine in the httpd.conf file, but here I don't know how to configure such a behaviour.
That's fine by me, because I can still check the website locally serving via Apache. The problem is that it looks that in the cloud this is the way to run the app as well, although I couldn't find more info in the documentation.
I'd be surprised that this is how the app is run in production because the php documentation states the following about the built-in server:
"It is not intended to be a full-featured web server. It should not be
used on a public network."
Are the web apps being run on Apache in the Swisscom Application Cloud? If yes, how do I get access to configure the httpd.conf and php.ini files? If no, how can I configure the special behavior I need for my app?
UPDATE:
Here is a sample php app which summarizes what I am trying to achieve: deploy it in cloud foundry interpreting html files as php files.
https://github.com/atineoSE/sample-php-app-cloudfoundry
Following #daniel-mikusa 's links to documentation I added special config related to the mime types under .bp-config/httpd/extra/httpd-mime.conf. This doesn't work as expected, though. Accessing from firefox, I am prompted to download the file. It works fine when I serve it locally via Apache with the same directive in the httpd.conf file.
The PHP build pack does not use php -s. I suppose that you could, but it's not the default. The default setup is to use PHP-FPM & Apache HTTPD, or ou can optionally use PHP-FPM w/Nginx.
For the most part, the PHP build pack should just run your app. There are occasionally things you need to adjust, and they are easily configurable by adding .bp-config/options.json to the root of your app.
I don't know anything about your app though, so I can't really say. If you can't get what you need with options.json you can customize the configuration for HTTPD, Nginx or PHP too. Check out the docs here for instructions to do that.
http://docs.cloudfoundry.org/buildpacks/php/gsg-php-config.html#engine-configurations
Hope that helps!

Launching a Mezzanine site live

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