Problem in deploying Django website on Cyber Panel - python

I have deployed the Django website on openlite server and cyberpanel. According to the documentation of the cyberpanel, there is no requirement to run the server manually. The default page of cyberpanel will be removed automatically once the Django website will be there. But in my case, that default page is still there. As this is not working, I tried it by executing the following command:
python manage.py runserver example.com:8000
After this, the website is working only on port 8000 i.e. "https://example.com:8000", but not on "https://example.com".
I have tried configuring all the settings in settings.py like setting the allowed host to ["*"] and also configuring the configurations of vhost in cyberpanel but still it is not working.
Can anyone help please ?

Related

My Bitnami Django website shows the Bitnami homepage instead of mine. How to change it?

I deployed a website on AWS LIGHTSAIL. I assigned an static IP to that instance and when I enter to it, it shows me the Bitnami homepage.
When I run the virtual env in the Django project (python manage.py runserver 0.0.0.0:8000) I have to put the :8000 on my static IP for my website to shows up.
What I'm doing wrong? How do I make my website appears on the default port? Thanks!

Django app deployment on shared hosting

I am trying to deploy a django app on hostgator shared hosting. I followed the hostgator django installation wiki and i deployed my app. The issue is that i am getting a 500 error internal page when entering the site url in the browser. I contacted the support team but could not provide enough info on troubleshooting the error Premature end of script headers: fcgi.This was the error found on the server error log.
I am installed django 1.9.5 on the server and from the django documentation it does not support fastcgi.
So my question 500 error be caused by the reason that i am running django 1.9.5 on the server and it does not support fastcgi. if so do i need to install lower version of django to support the fastcgi supported by hostgator shared hosting
First i thought the error was caused by my .htaccess file but it has no issue from the what i heard from support team.
Any Leads to how i can get the app up and running will be appreciated. This is my first time with django app deployment. Thank you in advance
I know this is a while as to when i asked the question. I finally fixed this by changing the hosts. I went for Digital Oceans (created a new droplet) which supports wsgi. I deployed the app using gunicorn (application server) and nginx (proxy server).
It is not a good idea to deploy a Django app on shared hosting as you will be limited especially installing the required packages.
Many hostings today that support python use Phusion Passenger and I have been able to deploy Django on it successfully. Before I share the procedure, let me mention that I faced a lot of problems in doing this and now I have the solution to all of them. I have already written a step by step guide on my blog here to deploy a Django app on shared hosting.
Start a new python app in cpanel. Specify the url where you want the app to be and the folder where you want to put the contents of the app. Set the Application startup file to passenger_wsgi.py and the Application entry point to application.
Copy the command to enter the virtual environment and run it via online terminal in CPanel or SSH.
Install version 2.1 of Django (latest 2.2 will not work) pip install django==2.1
Upload your django project to the folder you specified while setting up the app. There will be a passenger_wsgi.py file in that folder. Edit it and enter the following code: (replace myapp with your application name)
from myapp.wsgi import application
Edit the settings.py file and add the url of your appp to the ALLOWED_HOSTS list.
Set up the MySql database
Configure the path for static files in the settings.py and run python manage.py collectstatic
Again go to Setup python app in cpanel and restart the app.
As you say, Django 1.9 does not support FastCGI.
You could try using Django 1.8, which is a long term support release and does still support FastCGI.
Or you could switch to a different host that supports deploying Django 1.9 with wsgi.

How to Access URL of Localhost Django Project - Page Not Found

I transferred my Django project from a Ubuntu server that is currently serving the website. I'm trying to run this project on a localhost MacOSX environment for testing purposes. The command I'm familiar with for Django projects is:
python manage.py runserver
After which when I input 127.0.0.1:8000 into a browser, the project displays.
But my Ubuntu server is not currently running a script in that form, rather in the form of
python manage.py celeryd
My knowledge of how celery interfaces with Django is somewhat limited so this question may be very basic, but I can't find the URL to display the project.
On my Mac server, when I run:
python manage.py celeryd
the script does not error out on me--instead, it appears to be working by displaying this:
However, I don't know how to access the project. When I put 127.0.0.1 in the browser (and many other possible variations using different ports), I get Page Not Found.
Any help is greatly appreciated.
First you need to define 'core' template tag in one of your apps templatetags library say custom_tags.py. Make sure that this app is added to INSTALLED_APPS in settings. Then in your html template add
{% load custom_tags %}
It will fix the error you are getting. For more details please read docs.
You seem confused about what celery is. It is not a webserver, and it won't serve pages for you. It is an offline task manager, useful for performing complex or long running jobs that aren't appropriate to do in the context of a web request.
You'll need an actual web server alongside celery to serve your site itself.

Download and setup a Angular/Django site from server to localhost?

Hi I am new to Django and have been googling for a whole day without any success.
Basically there is a live/working website built with AngularJS, Django and PostgreSQL (Ubuntu 14.04) and I am trying to download all the files and clone the site into my localhost (Ubuntu 14.04).
After I downloaded the folder and finished install the required packages on my localhost, I run:
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
The server runs without reporting any errors.
However, some of the links are directed to a 404 page, such as this:
http://127.0.0.1:8000/city/chicago
Whereas in the live site, it would direct to the correct working page.
Can someone tell me what may have gone wrong in the process?
Thanks.
Try editing the settings.py file set the DEBUG value to True. Instead of a 404 you should get a full debug of the actual request and see what exactly is missing (I suspect missing data as #NightShadeQueen pointed).
Also you might have a look at django debug toolbar which prints the executed sql queries as well and run them against your local database to see what exactly they return.

Herkou site looks different at launch then django local server site

My issue is that when I view my site using python manage.py runserver or foreman start, I can see my site perfectly.
However, when I git push heroku master on the surface everything appears fine as no errors are given. But when I view my site with the Heroku given site link, I do not see my updated site as I see when I view my site using python manage.py runserver or foreman start.
I am building my site using 'pinax-theme-bootstrap` and my virtualenv is on my desktop directory.
Does anyone have a solution as to why this may be the case?
Here is a list of suggestions on how I would approach this issue with Heroku.
You should try heroku restart. This restarts your application and can help pick up new changes.
I would clear my browser cache as often I do not see changes on my web page if the browser has cached them.
I would check that the git repository on Heroku matches my local one in that it has all the newest changes made on my local server.

Categories

Resources