Exemplo n.º 1
0
if __name__ == '__main__':
    from celeb import app
    app.run()
Exemplo n.º 2
0
Arquivo: views.py Projeto: gobuk/celeb
                        thumb = image + '-thumb' + extension,
                        gallery = gallery
                        )
                    db.session.add(picture)
                    db.session.commit()
            #return redirect(url_for('edit_gallery', gallery=gallery.name))
                return redirect(url_for('show_gallery', gallery=gallery.name))
            else:
                error = 'There was a problem processing the URL. Please check URL.'
    return render_template('create_gallery.html', form=form, error=error)

@csrf_exempt
@login_required
@app.route('/gallery/<gallery>', methods=['GET', 'POST'])
def show_gallery(gallery):
    
    gallery = Gallery.query.filter_by(name=gallery).first_or_404()
    return render_template('show_gallery.html', gallery=gallery)

def get_year():
    x = datetime.datetime.now().year
    return x

app.jinja_env.globals['get_year'] = get_year

if __name__ == '__main__':
    if app.config.get('EXTERNAL', False):
        app.run(host=app.config.get('EXTERNAL_HOST', '192.168.0.1'))
    else:
        app.run()