Skip to content

profbiyi/site

 
 

Repository files navigation

Main site Django project

Build status

Coveralls status

Tag

License

The code provided in this repo will not run flawlessly without local modification and additional configuration; however, some parts may be useful references. Feel free to use it as a starting point for your own website.

To run locally, do the following (on Ubuntu 16.04):

  1. Install system dependencies.

    sudo apt-get install git python3-dev python3-pip \
        postgresql-9.5 postgresql-server-dev-9.5
    sudo -H pip3 install -U pip virtualenvwrapper
  2. Create a data directory and secrets.json.

    mkdir -p ~/data/conf && echo '
    { "secret_key": "xyz",
      "db_host": "localhost",
      "db_password": "db-secret",
      "gapi_key": "gapi-secret",
      "recaptcha_pri": "6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe",
      "recaptcha_pub": "6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI",
      "email_host_user": "foo@example.com",
      "email_host_pass": "email-secret" }
    ' > ~/data/conf/secrets.json
  3. Set environment variables.

    cat <<EOF>> ~/.bashrc && . ~/.bashrc
    set -a
    VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
    DJANGOPROJECT_DATA_DIR=~/data
    set +a
    . /usr/local/bin/virtualenvwrapper.sh
    EOF
  4. Configure the database.

    cat <<EOF | sudo -u postgres psql
    DROP DATABASE IF EXISTS agcs_db;
    CREATE DATABASE agcs_db;
    DO \$$ BEGIN
        IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'django') THEN
            CREATE ROLE django WITH CREATEDB PASSWORD '$(python3 -c \
                "import sys; exec('\n'.join(sys.argv[1:]))" "import json" \
                "with open('$DJANGOPROJECT_DATA_DIR/conf/secrets.json') as f:" \
                " print(json.load(f)['db_password'])")';
        END IF;
    END \$$;
    ALTER ROLE django SET default_transaction_isolation TO 'read committed';
    ALTER ROLE django SET timezone TO 'UTC';
    GRANT ALL PRIVILEGES ON DATABASE agcs_db TO django;
    EOF
  5. Create a Python 3.x virtualenv.

    mkvirtualenv -p python3 agcs
  6. Clone this repository.

    mkdir ~/site && cd ~/site
    git clone https://github.com/alphageek-xyz/site.git
    cd site && setvirtualenvproject
  7. Install dependencies and run tests.

    make install && make test
  8. Generate favicons and collect static files.

    make static
  9. Populate the database with some defaults.

    make load
  10. Run the development server.

    make run
  • Note: If you are modeling your own site after this one, the following steps will help ensure compliance with condition #3 of the LICENSE
    • Adjust all brand-related variables and settings
    • Use your own logo
    • Use your own fixtures

Packages

No packages published

Languages

  • Python 81.1%
  • CSS 14.2%
  • JavaScript 3.8%
  • Makefile 0.9%