Skip to content

dvk-net/django-dummy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dummy hello world Django app

Webapp deploy to www.pythonanywhere.com

img

  1. Visit and register https://www.pythonanywhere.com/

  2. Push your project to github

  3. Start bash console at pythonanywhere

  4. Git clone your project to pythonanywhere

  5. Create virtual env

    1. cd to clonned project dir
        python3 -m venv env
  6. Activate venv and install all dependencies

  7. Create new custom webapp at pythonanywhere

  8. Fill in all the gaps

    1. Source code: - the path to the folder with manage.py (/home/denniskot/django-dummy/src)
    2. Virtualenv:
      1. The path to the folder with virtual env (/home/denniskot/django-dummy/env)
    3. Static files:
      1. Create in bash conslole folders static and media on the same level as src folder. (/home/denniskot/django-dummy/static and /home/denniskot/django-dummy/media)
      2. Add url /static/ and directory /home/denniskot/django-dummy/static
      3. Add url /media/ and directory /home/denniskot/django-dummy/media
  9. Edit WSGI configuration file (click the link)

    1. Comment "hello world" section

    2. Find "django" section

      1. Comment out django section
      2. Change path to the folder with your 'manage.py' file (/home/denniskot/django-dummy/src)
      3. Change os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' where mysite is the project/module/folder name with 'settings.py' file (os.environ['DJANGO_SETTINGS_MODULE'] = 'proj.settings')
      # My WSGI file
      # +++++++++++ DJANGO +++++++++++
      # To use your own django app use code like this:
      import os
      import sys
      
      # assuming your django settings file is at '/home/denniskot/mysite/mysite/settings.py'
      # and your manage.py is is at '/home/denniskot/mysite/manage.py'
      path = '/home/denniskot/django-dummy/src'
      if path not in sys.path:
          sys.path.append(path)
      
      os.environ['DJANGO_SETTINGS_MODULE'] = 'proj.settings'
      
      # then:
      from django.core.wsgi import get_wsgi_application
      application = get_wsgi_application()
  10. Edit settings.py

    1. edit
      ALLOWED_HOSTS = ['yourloginname.pythonanywhere.com',]
    2. add lines below STATIC_URL
      # Change path in *_ROOT according to your static and media path
      MEDIA_URL = '/media/'
      STATIC_ROOT = '/home/denniskot/django-dummy/static'
      MEDIA_ROOT = '/home/denniskot/django-dummy/media'
  11. reload webapp

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages