I created a website with Django and now I need to deploy it and now I have to upload it to 1and1. Do I need a specific tool for this or can I upload it without hesitation like a website that only contains .html and .css files?
I created a website with Django and now I need to deploy it and now I have to upload it to 1and1. Do I need a specific tool for this or can I upload it without hesitation like a website that only contains .html and .css files?
python3 -m pip install --upgrade pippython3 -m pip install djangosource ~/.bashrc/full_path_to_homefolder/.local/bin and /full_path_to_homefolder/.local/lib, and source ~/.bashrc.django-admin startproject mysite # -*- coding: UTF-8 -*-
import os
import sys
import traceback
home = '/COMPLETE_PATH_TO_YOUR_FOLDER/work'
try:
project = os.path.join(home, 'mysite')
# Add a custom Python path.
sys.path.insert(0, project)
# Switch to the directory of your project.
os.chdir(project)
# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "mysite.settings"
from django_fastcgi.servers.fastcgi import runfastcgi
from django.core.servers.basehttp import get_internal_wsgi_application
wsgi_application = get_internal_wsgi_application()
runfastcgi(wsgi_application, method="prefork", daemonize="false", minspare=1, maxspare=1, maxchildren=1)
except:
traceback.print_exc(stdout)
with open(os.path.join(home, 'tmp/error.log'), 'w') as fp:
traceback.print_exc(file = fp)
vim .htaccess and add these contents: RewriteEngine on
RewriteBase /
# The following two lines are for FastCGI:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /apps/cgi-bin/application.fcgi/$1 [QSA,L]
python manage.py startapp appnameyour_website/work/ to see if it workspython manage.py check --deploy to secure your site for deploying.Just adding answer for those who are still trying to find the answer for deploying Django on shared ionos servers. There a complete guide on GitHub posted by sparagus.
Please make sure you have access for followings on system,
If above points are checked please go following steps to achieve django on shared hosting 1and1.