What is "Application startup file" option on Cpanel python application? - python

I'm trying to deploy my django project to my host using cpanel, but there are some new options in Create python applications tab. What should i set for the following items:
"Application startup file"
"Application Entry point"
create application

Ok it's actually pretty simple. When you want to deploy your Django app to cpanel, these field should be filled with:
Application startup file = Address of Manage.py file to start your app.
Application Entry point = Address of wsgi.py in your project folder.

Related

Multiple Django Projects using IIS but Getting Blank Page on Second Site

I'm running two django projects in IIS with wfastcgi enabled. The first django project is running without an issue but the second project displays a blank page (code 200) returned.
Second Project Info:
A virtual folder, within it's own application pool in IIS, is created to host the second project. The second project was created in an python environment folder. The second project runs from django using python manage.py runserver 0.0.0.0:8080, but displays a blank page when browsing to the virtual folder page.
The root folder was granted with "everyone" full control access to all sub-folders
for the second project, wfastcgi application and handler is pointing to the virtual environment python and wfastcgi file correctly.
Can you have two wfastcgi applications and handlers "Second Python FastCGI"
C:\project_folder\project_env\Scripts\python.exe|C:\project_folder\project_env\lib\site-packages\wfastcgi.py"
I wanted them separate so that two developers don't interfere with each others work, but they need to run within the same server and port.
I resolved the problem by editing the web.config file and removing the static handler from it. The static handler was being used instead of the FastCgiModule handler. The static handler should be moved below the FastCgiModule.

Can I upload Django project on Cpanel without CloudLinux installed

Hey guys i have made my django project successfully and I was ready to upload my django project to cpanel Linux shared Hosting which I bought but when I searched on Google on how to upload Django project to cpanel I found that there is a option in cpanel called Setup Python App which gives us features to upload Python Apps and this option is only shown on cpanels which have CloudLinux but I don't have CloudLinux and it is paid. My cpanel is only showing me Application Manager kind of thing under Software Option which I think could be an alternative to upload my app. Am I right, can I really do that with Application manager thing or is there any free way to upload my Django App on my bought cpanel. I bought Linux shared hosting in cpanel and bought a domain too. Please Help.
if you do have application manager on your cpanel there might be a way to run python WSGI application ( in your case the python WSGI will be your django app )
look at this article (https://www.liquidweb.com/kb/installing-python-wsgi-applications-on-cpanel/)
flowing the steps of this article you should be able to bring your django application on cpanel without the need buy CloudLinux which is TOOOOOO expensive for the only one little tiny thing you want from it
please not that since your cpanel allready have [Application manager] then you can skip the "yum install ea-ruby24-mod_passenger ea-apache24-mod_env" step as it would only be required if you don't already see Application manager on your cpanel account
to summerize the steps for you
1 : from your terminal (ssh) log in to your user account , and get into your user main directory ( or wherever you want to have your django appstored)
cd /home/username
2: create a virtual environment identical to your virtualenv on your local machine
3: put your django project file on your server ( you need to figure this out on your own )
4: create the Passenger WSGI file ( ideally on the same directory where you have your manage.py file
note that your django application should have its own wsgi.py file right next to settings.py
so instead of writing the Passenger WSGI file as described in the link ,
you would need to put only one line of code in it to import the django wsgi file
from project_name.wsgi import application

How to upload python modules on Heroku

I have Django app, which I deployed on Heroku.
All the modules were deployed whith requirements.txt and everything is ok
But I also have several classes which are made as modules in separate .py files. On local machine these modules are in ...\Python\Python38-32\Lib\site-packages\modules\ folder
Now I need to upload these modules to Heroku. But I don't know how to do it. Is there any file manager program for windows, which allows to connect to heroku server and upload these /modules/ folder to the site-packages directory?
I've tried to find such a program, but couldn't find anything
Deploy the app
In this step you will deploy the app to Heroku.
Create an app on Heroku, which prepares Heroku to receive your source code:
$ heroku create
When you create an app, a git remote (called heroku) is also created and associated with your local git repository.
Heroku generates a random name (in this case serene-caverns-82714) for your app, or you can pass a parameter to specify your own app name.
Now deploy your code:
$ git push heroku master
The application is now deployed. Ensure that at least one instance of the app is running:
$ heroku ps:scale web=1
Now visit the app at the URL generated by its app name. As a handy shortcut, you can open the website as follows:
$ heroku open

Django project to domain, vps

I have VPS-server (CentOS 6.8)
I installed Python 3.5.2 and Django 1.10.1 on virtual enviroment
I connected my domain to VPS-server
Now:
django-project:
(venv) /home/django_user/djtest/venv/django_project/django_project
domain:
/var/www/www-root/data/www/mydomain.com
I tried set BASE_DIR in settings.py to '/var/www/www-root/data/www/mydomain.com' but not working
How I can to connect django-project to domain?
Project is still empty, just created
Django project can't be served like this, you need some web-server application like gunicorn or apache too.
Just like you use ./manage.py runserver you need some application to execute your django project corresponsing to command theses application are Gunicorn, ApacheWSGI server and others.
There will be a file wsgi.py that would have created when you created the project it's web server gateway interface it will interact with the above mentioned web-servers and server your django based website.

Hosting Django and Path to Project Directory

I am using a digital ocean virtual server to host a django web app. when you create the droplet, it creates a default app in the directory /home/django/django_project/django. However seeing as this isn't the app I want to host, I put my application files into the directory /home/myproject/myapp and updated the gunicorn and nginx configs to point there. However once updating the urls for this app, I am trying to see it online and noticed that the 404 looked like this:
which states that the URLconf is defined in django_project.urls which I had since deleted out of that 'home/django directory. I have reloaded and restarted gunicorn and nginx in an attempt to get django to realize that the project django_project doesn’t exist any more, but no luck. Has anyone run into this before or have any suggestions as to what I should try next?

Categories