You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Daniel Beadle 5b50257ec6 Fix inline code syntax 2 months ago
app More database migratiosn 2 months ago
tests More database migratiosn 2 months ago
.gitignore Ignore our new database files 2 months ago
README.md Fix inline code syntax 2 months ago
client.py More database migratiosn 2 months ago
conf.wsgi Add conf.wsgi for Apache 2 months ago
config-example.py Finish migrating DB to config defined value 2 months ago
config.py add testing config 2 months ago
conftest.py 2,988 miles worth of code 2 months ago
game_data Add tavern testing to requirements.txt 2 months ago
game_data_dev Fix config db reference 2 months ago
myapp.py Fix config db reference 2 months ago
requirements.txt Add tavern testing to requirements.txt 2 months ago
server.py 2,988 miles worth of code 2 months ago

README.md

Hi Fugue! Thanks for taking the time to consider my application. I’ve had some fun with it and I hope to hear from you soon!

Running the Client

The client is a single Python script, aptly named ‘client.py’. I have set up the server on a virtual machine running at https://danielbeadle.net so you can try it quickly. Instructions for running the server (pretty standard for Flask) are also included below.

  1. Install the venerable requests package either in a virtual environment or outside of it (if you like living dangerously)

  2. Activate your virtual environment (if necessary)

  3. Run the client and follow the instructions on the screen.

F.A.Q.

Q: How can I change what server the client points to?

Modify the variable at the top of client.py called “HOST”.

Q: Can I see the high scores?

Yes! https://danielbeadle.net/fugue/highscores The top ten games that were successfully guessed the fastest appear here.

Q: Can I see the results of all the games?

Sure! https://danielbeadle.net/fugue/highscores

Q: What’s the function called “numberwang”?

Numberwang is a recurring sketch in Series 1 and 2 of That Mitchell and Webb Look. It is a fictional television series in which the two contestants call out seemingly random numbers which are occasionally told to be Numberwang.

Source: https://thatmitchellandwebb.fandom.com/wiki/Numberwang!

Will determining if a number is numberwang help you guess the answer? No. Will it be a useless waste of your guesses? Yes. Will the numberwang() function always return the same answer? Also no.

It’s probably best if you watch the sketch for yourself. https://youtu.be/0obMRztklqU

Setting up the server

Prerequisites Python3 and Pip (install guide), virtualenv (install guide), and git (another install guide).

  1. Clone the repository

  2. Navigate to the repository’s top level (the level with ‘README.md’, ‘requirements.txt’, the folder ‘app’, etc)

  3. Create a virtual environment with python 3 and enter it (guide here)

  4. Install the required python packages from requirements.txt (guide here)

  5. Set the Flask environment variables as follows

Unix / Mac OS:

export FLASK_ENV=development
export FLASK_APP=myapp

Windows CMD:

set FLASK_ENV=development
set FLASK_APP=myapp

Windows PowerShell:

$env:FLASK_ENV='development'
$env:FLASK_APP='myapp.py'
  1. Run it!
flask run

Deploying to Apache

Add this (or something similar) to a virtual host

WSGIDaemonProcess fugue python-home=/home/djbeadle/Daniel-fugue-take-home/venv/ home=/home/djbeadle/Daniel-fugue-take-home
WSGIApplicationGroup %{GLOBAL}
WSGIScriptAlias /fugue /home/djbeadle/Daniel-fugue-take-home/conf.wsgi
<Directory /home/djbeadle/Daniel-fugue-take-home>
    WSGIProcessGroup fugue
    Options FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

Build and Test

To test the application:

  1. Start the server (or use the server already running at <https://danielbeadle.net/fugue≥)

  2. Open the project folder in another terminal session, point the tests at your host by editing tests/common.yaml

  3. From the project folder’s root directory activate your virtualenv and run the command pytest -v