A Flask web application built with Python 3.
-
Clone the repository and cd into it.
$ git clone https://github.com/gamefolk/gamefolk.org && cd gamefolk.org
-
Create a Python file somewhere outside of the repository. This file will contain secret information relevant to the application that should not be pushed the respository. The file should contain the following key-value pairs:
DEBUG = True SQLALCHEMY_DATABASE_URI = 'sqlite:////path/to/local/db' SECRET_KEY = '...' RECAPTCHA_PUBLIC_KEY = '...' RECAPTCHA_PRIVATE_KEY = '...' PAYPAL_MERCHANT_ID = '...' PAYPAL_MERCHANT_EMAIL = '...' CARTRIDGE_COST = '...' MAIL_SERVER = '...' MAIL_PORT = '...' MAIL_USERNAME = '...' MAIL_PASSWORD = '...' DEFAULT_MAIL_SENDER = '...'
-
Move your Python config file into your current directory.
-
If you don't have the docker daemon already running, start it now.
-
Build the image and run the application.
$ docker-compose build $ docker-compose up
-
Navigate to
localhost:5000
in your browser.
This application requires Python 3.3+ and node.js. The application is served using Flask and node.js handles the frontend dependencies. If you're using Linux, these programs can be installed using your distro's package manager. If you're using OS X or Windows, I suggest using an unofficial package manager such as homebrew or chocolatey, respectively.
-
Install command-line tools.
$ sudo pip install virtualenv $ sudo npm install -g grunt-cli
-
Create and activate a virtualenv.
$ virtualenv -p /path/to/your/python3 . $ source bin/activate
-
Install local dependencies.
$ pip install -r requirements.txt $ npm install $ grunt
-
Export an environment variable so that Flask can find the secret configuration.
$ export GAMEFOLK_SETTINGS=/path/to/the/file/you/just/made.py
-
Run the application.
$ python application.py
-
Navigate to
localhost:5000
in your browser.
If you want to test the site's PayPal integration, there are some additional steps:
-
Install localtunnel. This program allows you to pipe requests from the internet to your local machine without setting up your machine as a web server.
$ sudo npm install -g localtunnel
-
With the application already running, open another terminal and run localtunnel, telling it that we want to redirect traffic to the default Flask port 5000.
$ lt --port 5000
-
Open the URL that localtunnel outputs in your browser. Note: due to the way that recaptcha verifies registration, you will have to register accounts on localhost rather than through the localtunnel.
To test email integration, you will need to set up a fake STMP server. Thankfully, Python comes with one built in. Just open up another terminal and execute
sudo python -m smptd -n -c DebuggingServer localhost:25
If you are editing the website's CSS, you can run grunt watch
to automatically
rebuild the CSS when the files change.