You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			22 lines
		
	
	
		
			519 B
		
	
	
	
		
			Python
		
	
			
		
		
	
	
			22 lines
		
	
	
		
			519 B
		
	
	
	
		
			Python
		
	
from flask import Flask, render_template
 | 
						|
from random import choice
 | 
						|
from descriptions import descriptions
 | 
						|
from local_settings import BASEURL
 | 
						|
 | 
						|
app = Flask(__name__)
 | 
						|
 | 
						|
@app.route('{}/'.format(BASEURL))
 | 
						|
def index():
 | 
						|
 | 
						|
  pick = choice(descriptions)
 | 
						|
 | 
						|
  context = {
 | 
						|
    'BASEURL': BASEURL,
 | 
						|
    'image_id': pick[0],
 | 
						|
    'file': pick[1],
 | 
						|
    'description': pick[2],
 | 
						|
    'color': pick[3],
 | 
						|
    'color_string': 'rgb({})'.format(', '.join(map(str, pick[3]))),
 | 
						|
    'audio': pick[4]
 | 
						|
  }
 | 
						|
  return render_template('index.html', **context) |