A minimalist photo album powered by Flask and React
JavaScript Python HTML CSS Mako
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
logs Added application logging Nov 15, 2015
migrations
.bowerrc Added basic auth and jsx on the fly compilation Jan 1, 2014
.buildpacks
.editorconfig
.foreman Fixed gallery delete Mar 26, 2016
.gitignore Added letsencrypt Nov 16, 2016
Gruntfile.js
LICENSE
Procfile
README.md Removed AWS SQS (Queue) code and verify thumbnail code Mar 27, 2016
bower.json
config.py
manage.py
package.json
requirements.txt Integrated Flask Boilerplate into this repo (https://github.com/taera… Mar 26, 2016
server.cgi Removed AWS SQS (Queue) code and verify thumbnail code Mar 27, 2016
server.py

README.md

Ineffable Stories in Ready

Ineffable is a minimalist photo gallery.

Requirements

You'll need the following:

  • A Heroku account, if you want to deploy to Heroku.
  • An Amazon AWS account, including your AWS Access Key and Secret Key
  • An Amazon S3 bucket, for storing the images

Setup

Amazon S3

  • Create a bucket in S3
  • Right click on the bucket, and select Properties
  • Under Permissions, click Edit CORS Configuration
  • Change the domain name(s) below to match your configuration:
<CORSConfiguration>
    <CORSRule>
        <AllowedOrigin>http://ineffable.example.com</AllowedOrigin>
        <AllowedOrigin>https://ineffable.example.com</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>POST</AllowedMethod>
        <AllowedMethod>PUT</AllowedMethod>
        <AllowedMethod>HEAD</AllowedMethod>
        <AllowedHeader>*</AllowedHeader>
    </CORSRule>
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>HEAD</AllowedMethod>
    </CORSRule>
</CORSConfiguration>

Local development setup:

    # Clone the repo
    git clone https://github.com/taeram/ineffable.git
    cd ./ineffable

    # Setup and activate virtualenv
    virtualenv .venv
    source ./.venv/bin/activate

    # Install the pip requirements
    sudo apt-get install postgresql-client postgresql-common libpq-dev python-dev mysql-client libmysqld-dev
    pip install -r requirements.txt

    # Create the development database (SQLite by default)
    python manage.py database migrate upgrade
    python manage.py database setup

    # Install global npm tools
    npm install -g less

    # Export the config variables
    export AWS_ACCESS_KEY_ID=secret \
           AWS_SECRET_ACCESS_KEY=secret \
           AWS_REGION=us-east-1 \
           AWS_S3_BUCKET=my-photo-bucket \
           MAX_UPLOAD_SIZE=10485760 \
           SECRET_KEY=secret_key \
           LAMBDA_INSTRUCTIONS='[
              {
                "height": 200,
                "width": 200,
                "suffix": "thumb",
                "quality": 90
              },
              {
                "height": 1200,
                "width": 1200,
                "suffix": "display",
                "quality": 80
               }
            ]'

    # Start the application, prefixing with the required environment variables
    python server.py

Heroku setup:

    # Clone the repo
    git clone https://github.com/taeram/ineffable.git
    cd ./ineffable

    # Create your Heroku app, and the addons
    heroku apps:create
    heroku addons:add heroku-postgresql

    # Promote your postgres database (your URL name may differ)
    heroku pg:promote HEROKU_POSTGRESQL_RED_URL

    # Tell Heroku we need a custom buildpack (for python + nodejs)
    heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git

    # Set the flask environment
    heroku config:set FLASK_ENV=production

    # Set the application config
    heroku config:set AWS_ACCESS_KEY_ID=secret \
                      AWS_SECRET_ACCESS_KEY=secret \
                      AWS_REGION=us-east-1 \
                      AWS_S3_BUCKET=my-photo-bucket \
                      MAX_UPLOAD_SIZE=10485760 \
                      SECRET_KEY=secret_key \
                      LAMBDA_INSTRUCTIONS='[
                        {
                          "height": 200,
                          "width": 200,
                          "suffix": "thumb",
                          "quality": 90
                        },
                        {
                          "height": 1200,
                          "width": 1200,
                          "suffix": "display",
                          "quality": 80
                        }
                      ]'

    # Add a Google Analytics ID if you want to track visitors
    heroku config:set GOOGLE_ANALYTICS_ID=<your Google Analytics id>

    # Create the production database
    heroku run python manage.py database migrate upgrade
    heroku run python manage.py database setup

    # Push to Heroku
    git push heroku master

Upgrading to a new Release

When upgrading to a new release, simply pull down the new copy, and migrate the database:

python manage.py database migrate upgrade

If you're migrating a Heroku app, just prefix the above command with heroku run.