CREATE<\/strong> after finishing the form.<\/p>\n\n\n\nFlask Project initialization in Python Hosting in cPanel<\/h3>\n\n\n\n Flask is lightweight microframework in python used for building web applications.<\/p>\n\n\n\n
For creating the Flask application implement the following steps:<\/strong><\/p>\n\n\n\n\nCreate requirements.txt and app.py files<\/strong>\n\nAfter creating the application go to the tools>> Files>> File Manager.<\/li>\n\n\n\n Go to the application root folder, create requirements.txt and app.py files.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n\n\n\n\nEdit requirements.txt file<\/strong>\n\nSelect requirements.txt, click on edit and add following required Flask library.<\/li>\n\n\n\n Click on Save Changes.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n\n\n\n\nFlask<\/code><\/pre>\n<\/blockquote>\n\n\n\n\nEdit app.py<\/strong><\/li>\n<\/ol>\n\n\n\n\nfrom flask import Flask\n\napp = Flask(__name__)\n\n@app.route(\"\/\")\ndef hello():\n return \"Hello, World!\"<\/code><\/pre>\n<\/blockquote>\n\n\n\n\nEdit passenger_wsgi.py<\/strong><\/li>\n<\/ol>\n\n\n\n\nimport os\nimport sys\nimport importlib.util\nimport importlib.machinery\n\nsys.path.insert(0, os.path.dirname(__file__))\n \ndef load_source(modname, filename):\n loader = importlib.machinery.SourceFileLoader(modname, filename)\n spec = importlib.util.spec_from_file_location(modname, filename, loader=loader)\n module = importlib.util.module_from_spec(spec)\n loader.exec_module(module)\n return module\n \nwsgi = load_source(\"wsgi\", \"app.py\") \napplication = wsgi.app #Note:app should be present in the entry point<\/code><\/pre>\n<\/blockquote>\n\n\n\n\nRestart the application.<\/strong><\/li>\n\n\n\nYour application will run.<\/strong><\/li>\n<\/ol>\n\n\n\n\n <\/figure>\n<\/blockquote>\n\n\n\nDjango Project initialization in Python Hosting in cPanel<\/h3>\n\n\n\n Django is a Python-based framework that helps developers build web applications.This framework is flexible, safe, and packed with features.<\/p>\n\n\n\n
For creating the Django application implement the following steps:<\/strong><\/p>\n\n\n\n\nCreate a virtual environment for Django<\/strong><\/li>\n<\/ol>\n\n\n\n <\/figure>\n\n\n\n\nCopy the link which is given on the top of the table.<\/li>\n\n\n\n Go to the tools section.<\/li>\n\n\n\n Then go to advance section, click on terminal.<\/li>\n\n\n\n Paste the copied link on the terminal. <\/li>\n\n\n\n Hit Enter.Then you will be in the virtual environment. <\/li>\n\n\n\n Enter the following command on terminal.<\/li>\n<\/ol>\n\n\n\n\npython --version<\/code><\/pre>\n<\/blockquote>\n\n\n\nIt will display the version of python.<\/p>\n\n\n\n
\nDjango Installation<\/strong><\/li>\n<\/ol>\n\n\n\n\nAdd the following installation command on terminal:<\/li>\n<\/ul>\n\n\n\n\npip install Django<\/code><\/pre>\n\n\n\nor<\/p>\n\n\n\n
pip3 install Django<\/code><\/pre>\n\n\n\n <\/figure>\n<\/blockquote>\n\n\n\n\nTo start a project add the following command on the terminal:<\/li>\n<\/ul>\n\n\n\n\ndjango-admin startproject dJangoproject .<\/code><\/pre>\n\n\n\nThe folder named dJangoproject will be created in the application root.<\/p>\n<\/blockquote>\n\n\n\n
<\/p>\n\n\n\n
\nIn setup add \u201cdJangoproject\/wsgi.py\u201d in Application startup file. Then restart the application.<\/li>\n<\/ul>\n\n\n\n\n <\/figure>\n<\/blockquote>\n\n\n\n\nVisit site, check for following screen.<\/li>\n<\/ul>\n\n\n\n\n <\/figure>\n<\/blockquote>\n\n\n\n\nGo to the tools>> Files>> File Manager.<\/li>\n\n\n\n In application root folder, go to dJangoproject folder.<\/li>\n\n\n\n Edit settings.py file add \u201cALLOWED_HOSTS = [‘example.com’]\u201d.<\/li>\n<\/ul>\n\n\n\n\n <\/figure>\n<\/blockquote>\n\n\n\n\nReload the setup application.<\/li>\n\n\n\n If the given below screen shows up it means Django is installed.<\/li>\n<\/ul>\n\n\n\n\n <\/figure>\n<\/blockquote>\n\n\n\nFastAPI Project initialization in Python Hosting in cPanel<\/h3>\n\n\n\n FastAPI is high-performance web framework in python used for building APIs. It provides asynchronous support and efficient data handling.<\/p>\n\n\n\n
For creating the FastAPI application implement the following steps:<\/strong><\/p>\n\n\n\n\nCreate requirements.txt and app.py files<\/strong>\n\nAfter creating the application go to the tools>> Files>> File Manager.<\/li>\n\n\n\n Go to the application root folder, create requirements.txt and app.py files.<\/li>\n<\/ol>\n<\/li>\n\n\n\n Edit requirements.txt file<\/strong>\n\nSelect requirements.txt, click on edit and add following required fastapi and a2wsgi libraries.<\/li>\n\n\n\n Click on Save Changes.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n\n\n\n\nfastapi\na2wsgi<\/code><\/pre>\n<\/blockquote>\n\n\n\n\nEdit app.py<\/strong><\/li>\n<\/ol>\n\n\n\n\nfrom fastapi import FastAPI\napp = FastAPI()\n\n@app.get(\"\/\")\ndef read_root():\n return {\"Hello\": \"World\"}<\/code><\/pre>\n<\/blockquote>\n\n\n\n\nEdit passenger_wsgi.py<\/strong><\/li>\n<\/ol>\n\n\n\n\nfrom a2wsgi import ASGIMiddleware\nfrom app import app\n\napplication = ASGIMiddleware(app)<\/code><\/pre>\n<\/blockquote>\n\n\n\n\nRestart the application.<\/strong><\/li>\n\n\n\nYour application will run.<\/strong><\/li>\n<\/ol>\n\n\n\n\n <\/figure>\n<\/blockquote>\n\n\n\nConclusion:<\/h2>\n\n\n\n This article summing up covering step-by-step procedure to deploy and manage Python applications on server using cPanel with Python Hosting.This article is written considering simple Python applications of each framework as described above.<\/p>\n","protected":false},"excerpt":{"rendered":"
Using the Setup Python App tool, deploying Python applications is now straightforward and uncomplicated thanks to cPanel’s Python hosting. Basically, […]<\/p>\n","protected":false},"author":176,"featured_media":1252,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[100,107,109,108,101,106,104,102,103,105],"class_list":["post-1157","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-deploy-python-app","tag-django","tag-fastapi","tag-flask","tag-manage-python-app","tag-passenger","tag-pip-install","tag-python-hosting","tag-python-hosting-using-cpanel","tag-requiremenets-txt"],"yoast_head":"\n
Python Hosting with cPanel, Deploy and Manage Python App -<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n \n \n \n \n \n\t \n\t \n\t \n