GithubHelp home page GithubHelp logo

abhishek-2502 / django_webhosting_pythonanywhere Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 38 KB

Host a Django website on PythonAnywhere using this guide.

Home Page: https://abhishekrajput.pythonanywhere.com/

License: MIT License

Python 96.12% HTML 3.88%

django_webhosting_pythonanywhere's Introduction

Django Web Hosting

Welcome to the Django Web Hosting guide! This repository provides instructions for hosting a Django website on PythonAnywhere. Follow the steps below to create an account on PythonAnywhere, clone the repository, set up a virtual environment, and configure your Django project.

Table of Contents

Getting Started

  1. Create an Account on PythonAnywhere: Sign up for an account on PythonAnywhere.

  2. Access Bash on PythonAnywhere: Once you've created your account, navigate to the PythonAnywhere dashboard and launch a new Bash console to execute the following commands.

  3. Clone the Repository: Change repository link according to your repository

    git clone https://github.com/Abhishek-2502/django_webhosting
  4. Create a Virtual Environment:

    mkvirtualenv venv
  5. Changing path: Get inside the Folder where manage.py is present (Use ls to look content of folder)

     cd django_webhosting
     cd django_webhosting
  6. Install Django:

    pip install django
  7. Create an web app: Create an django based web app located on dashboard and choose manual configuration.

Project Configuration

In your Django project's settings.py file which can be accessed through the files in dashboard, make the following changes:

  1. Set Debug Mode:

    DEBUG = True
  2. Specify Allowed Hosts: Change user name according to you

    ALLOWED_HOSTS = ['AbhishekRajput.pythonanywhere.com']
  3. Configure Templates Directory: Change path according to your templates folder

    TEMPLATES = [
        {
            'BACKEND': 'django.template.backends.django.DjangoTemplates',
            'DIRS': ['/home/AbhishekRajput/django_webhosting/django_webhosting/templates'],  
            # Other template settings...
        },
    ]

WSGI Configuration

In your Django project's WSGI configuration file (wsgi.py) which can be accessed through the website in web app, uncomment and modify the following code:

# +++++++++++ DJANGO +++++++++++

import os
import sys

path = '/home/AbhishekRajput/django_webhosting/django_webhosting' #Change this path where your manage.py is present
if path not in sys.path:
    sys.path.append(path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'django_webhosting.settings' #Change this path where your settings.py is present

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

Virtual Environment

In your PythonAnywhere account, navigate to the virtual environment section and add the virtual environment you created:

  • Add Virtual Environment: venv

By following these steps, you will have successfully hosted your Django website on PythonAnywhere.

For any further assistance or issues, please feel free to open an issue or submit a pull request.

Author

Abhishek Rajput.

django_webhosting_pythonanywhere's People

Contributors

abhishek-2502 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.