Skip to content

tsadimas/django-posts

Repository files navigation

How to use this repo

  • create a folder, let's say myproject
  • cd myproject
  • create a virtualenv
virtualenv -p python3 venv
  • move into virtual environment and activate it
cd venv
source bin/activate
  • clone this repo
git clone https://github.com/tsadimas/django-posts
  • install the dependencies
pip install -r requirements.txt

Use a database backend

  • create a file db.json in git root directory, with the following
{
    "NAME": "dbname",
    "USER": "user",
    "PASSWORD": "pass",
    "HOST": "localhost",   
    "PORT": "3306"
}

Deploy to gCloud

install gunicorn

pip install gunicorn
  • set up STATIC_ROOT, ALLOWED_HOSTS in settings.py
ALLOWED_HOSTS = [
    os.environ['DEPLOY_HOST'],
    '127.0.0.1',
]
STATIC_ROOT = os.path.join(BASE_DIR, "static/")
  • create a file named app.yaml in project root directory

sample file:

entrypoint: gunicorn -b :$PORT postsproject.wsgi
env: flex
runtime: python

env_variables:
  DEBUG: 'False'
  DEPLOY_HOST: "XXXXXXXXX.appspot.com"

handlers:
- url: /static
  static_dir: static
  • run
python manage.py collectstatic

gcloud init

Run

gcloud init 

select your gcloud account and your project Run

gcloud app deploy

see your app with

gcloud app browse

Links:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published