GitHub Readme.md
In order to test this you will need:
Before you start testing, you need to create a reddit application.
questionnaire for /r/mysubreddit (in development)
). I put in development
in there to separate it from when it goes live.http://localhost:5000/about
http://localhost:5000/authorize_callback
That's it. I probably made it sound harder than it is.
Here's the process in screenshots:
Go to reddit app preferences (step 1 above):
Fill in the values (step 1.1 through 1.5 above):
After pressing the "create app button" (step 1.6 above):
Note the client id (yellow) and the client secret (orange) (step 2 above):
Ok, now you just need to create a new database to record any answers. This will only be for development, of course. If/when you deploy to heroku, the database will be created from heroku itself.
If you have chosen to download the raw binaries (Windows or Linux), you should also run the following batch file (just put it on the folder you've unzipped the binaries)
@ECHO OFF
REM The script sets environment variables helpful for PostgreSQL
SET PATH="%~dp0\bin";%PATH%
SET PGDATA=%~dp0\data
SET PGDATABASE=postgres
SET PGUSER=postgres
SET PGPORT=5432
SET PGLOCALEDIR=%~dp0\share\locale
REM The line below is only needed the first time you run this
IF NOT EXIST "%PGDATA%" (
"%~dp0\bin\initdb" -U postgres -A trust
)
"%~dp0\bin\pg_ctl" -D "%~dp0/data" -l logfile start
ECHO Press any key to stop server
PAUSE
"%~dp0\bin\pg_ctl" -D "%~dp0/data" stop
or, for Linux
#!/bin/sh
# The script sets environment variables helpful for PostgreSQL
export PATH=$PATH:$(pwd)/bin
export PGDATA=$(pwd)/data
export PGDATABASE=postgres
export PGUSER=postgres
export PGPORT=5432
export PGLOCALEDIR=$(pwd)/share/locale
echo $PATH
echo $PGDATA
# The line below is only needed the first time you run this
if [ ! -d "$PGDATA" ]; then
$(pwd)/bin/initdb -U postgres -A trust
fi
$(pwd)/bin/pg_ctl -D $(pwd)/data -l logfile start
read -p "Press [Enter] to stop server." key
$(pwd)/bin/pg_ctl -D $(pwd)/data stop
When developing, you need to set up the following environment variables (either at system level, or set them up in a batch file).
postgresql+pg8000://postgres@localhost/questionnaire
python -c "import base64,os;print(base64.b64encode(os.urandom(48)).decode())"