I'm trying to follow the "Turning a Python script into a website" tutorial. I have not met with Lady Success. I'd appreciate any assistance that can be offered.
My script works fine in Windows CLI, and takes no input. It prints 10 random scales, which can be used for music practice. Each scale consists of 1 of 12 keys, and 1 of 7 modes (called 'scales' in the script).
Here is the original python script:
import random
keys = ['C','F','Bb','Eb','Ab','Db','F#','B','E','A','D','G']
scales = ['Dorian','Lydian','Phrygian','Mixolydian','Aeolian','Locrian','Lydian Dominant','Diminished Whole Tone']
print()
print('Here are your ten scales:')
count = 1
while count < 11:
random_index0 = random.randint(0,len(keys)-1)
random_index1 = random.randint(0,len(scales)-1)
print()
print(count,')',keys[random_index0],scales[random_index1])
count = count + 1
The tutorial talks about configuring html input. I don't need any input.
Here are my two files so far
flask_app.py:
A very simple Flask Hello World app for you to get started with...
import random
from flask import Flask
from processing import pick_scales
app = Flask(__name__)
app.config["DEBUG"] = True
@app.route('/')
processing.py
import random
def pick_scales:
return random_index0, random_index1
keys = ['C','F','Bb','Eb','Ab','Db','F#','B','E','A','D','G']
scales = ['Dorian','Lydian','Phrygian','Mixolydian','Aeolian','Locrian','Lydian Dominant','Diminished Whole Tone']
print()
print('Here are your ten scales:')
count = 1
while count < 11:
random_index0 = random.randint(0,len(keys)-1)
random_index1 = random.randint(0,len(scales)-1)
print()
print(count,')',keys[random_index0],scales[random_index1])
count = count + 1
Unsurprisingly, it doesn't work. Thanks so much in advance.
Peter