Esempio n. 1
0
"""
This script runs the FlaskWebProject application using a development server.
"""

from os import environ
from FlaskWebProject import app

if __name__ == '__main__':
    HOST = environ.get('SERVER_HOST', 'localhost')
    try:
        PORT = int(environ.get('SERVER_PORT', '5555'))
    except ValueError:
        PORT = 5555
    app.run(HOST, PORT, debug="true")
Esempio n. 2
0
"""
This script runs the FlaskWebProject application using custom development server.
"""

from os import environ
from FlaskWebProject import app

if __name__ == '__main__':
    # from waitress import serve
    # serve(app, host="0.0.0.0", port=5555)
    HOST = environ.get('SERVER_HOST', '0.0.0.0')
    try:
        PORT = int(environ.get('SERVER_PORT', '5555'))
    except ValueError:
        PORT = 5555
    app.run(HOST, PORT)
Esempio n. 3
0
"""
This script runs the FlaskWebProject application using a development server.
"""

from os import environ
from FlaskWebProject import app

if __name__ == '__main__':
    HOST = environ.get('SERVER_HOST', 'localhost')
    try:
        PORT = int(environ.get('SERVER_PORT', '5000'))
    except ValueError:
        PORT = 5000
    app.run(HOST, PORT)
Esempio n. 4
0
                        rand_val -= value
                        
        return output_str

''' Request audio from text. Save to file '''
def get_audio(text):
        formatted_text = urllib2.quote(text)

        audio_url = urllib2.urlopen(BASE_URL + formatted_text).geturl()
        audio_data = urllib2.urlopen(audio_url).read()

        audio_file = open(AUDIO_FILENAME, 'wb')
        audio_file.write(audio_data)
        audio_file.flush()
        audio_file.close()


if __name__ == '__main__':
        app.run(port=33334)#, debug=True)

#pyglet.resource.path = [os.getcwd()]
#pyglet.resource.reindex()

#linesM = get_lines("macbeth.txt", "MACBETH")
#markovM = gen_markov(linesM.values())

#t = generate("good evening", markovM, linesM)
#with open("Output.txt", "w") as text_file:
#	text_file.write(t)
#get_audio(t)
Esempio n. 5
0
"""
This script runs the FlaskWebProject application using a development server.
"""

from os import environ
from FlaskWebProject import app

if __name__ == '__main__':
    HOST = environ.get('SERVER_HOST', 'localhost')
    try:
        PORT = int(environ.get('SERVER_PORT', '8000'))
    except ValueError:
        PORT = 8000
    app.run(HOST, PORT, ssl_context='adhoc')
Esempio n. 6
0
    t2 = datetime.now()
    msg = "Deleted successfully"
    return render_template('user.html', loginid=loginid, imsg=msg,
                           uploadtime="Time taken to delete is :" + str(t2 - t1))


# Logging out 
@app.route('/logout', methods=['POST'])
def logout():
    global startt1
    session.clear()
    t2 = datetime.now()
    msg = "Thank you for using Pixelate"
    return render_template('home.html', logintime="Time taken to logout is :" + str(t2 - startt1), imsg=msg)


@app.errorhandler(404)
def page_not_found(e):
    """Return a custom 404 error."""
    return 'Sorry, Nothing at this URL.', 404


@app.errorhandler(500)
def application_error(e):
    """Return a custom 500 error."""
    return 'Sorry, unexpected error: {}'.format(e), 500


if __name__ == "__main__":
    app.run()
Esempio n. 7
0
"""
This script runs the FlaskWebProject application using a development server.
"""

from os import environ
from FlaskWebProject import app

if __name__ == '__main__':
    HOST = environ.get('SERVER_HOST', 'localhost')
    try:
        PORT = int(environ.get('SERVER_PORT', '5555'))
    except ValueError:
        PORT = 5555
    app.run(HOST, PORT, debug=True)
Esempio n. 8
0
        except NameError:
            entries = None
        
        if entries is None:
            db = get_db()
            cur = db.execute('select * from metadata where lfd in (select distinct lfd from tatorttweets) order by lfd desc')
            entries = cur.fetchall()
    
        if selected is not None: 
            db = get_db()
            cur = db.execute("SELECT lfd FROM tatorttweets WHERE lfd='" + selected + "' LIMIT 1")
            if not cur.fetchone(): 
                return render_template('base.html', entries=entries)
            
        return render_template('base.html', entries=entries, selected=selected)


    
    if request.method == 'POST':
        
        dataset = request.form.items()
        current_app.logger.debug(dataset[0][1])
        
        return redirect(url_for('work', selected=dataset[0][1]))
    
#         return render_template('base.html', entries=entries, selected=dataset[0][1])
     

if __name__ == '__main__':
    app.run()
Esempio n. 9
0
#!/usr/local/bin/python2.7

from FlaskWebProject import app
app.run(host='0.0.0.0')
Esempio n. 10
0
"""
This script runs the FlaskWebProject application using a development server.
"""

from os import environ
from FlaskWebProject import app

if __name__ == '__main__':
    HOST = environ.get('SERVER_HOST', 'localhost')
    try:
        PORT = int(environ.get('SERVER_PORT', '5555'))
    except ValueError:
        PORT = 5555
    # app.run(HOST, PORT)
    app.run(port=8001)
Esempio n. 11
0
"""
This script runs the FlaskWebProject application using a development server.
"""

from os import environ
from FlaskWebProject import app

if __name__ == '__main__':
    HOST = environ.get('SERVER_HOST', 'localhost')
    try:
        PORT = int(environ.get('SERVER_PORT', '5555'))
    except ValueError:
        PORT = 5555

    app.run(HOST, PORT, debug=True, threaded=True)
    #app.run(HOST, PORT, debug=True)

"""
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from FlaskWebProject import app

http_server = HTTPServer(WSGIContainer(app))
http_server.listen(5555)
IOLoop.instance().start()

"""
"""
from gevent.wsgi import WSGIServer
from FlaskWebProject import app
Esempio n. 12
0
"""
This script runs the FlaskWebProject application using a development server.
"""
from os import environ
from FlaskWebProject import app

if __name__ == '__main__':
    HOST = environ.get('SERVER_HOST', 'localhost')
    try:
        PORT = int(environ.get('SERVER_PORT', '5555'))
    except ValueError:
        PORT = 5555
    app.debug = True
    app.run(HOST, PORT, threaded=True)
Esempio n. 13
0
"""
This script runs the FlaskWebProject application using a development server.
"""

from os import environ
from FlaskWebProject import app

if __name__ == "__main__":
    HOST = environ.get("SERVER_HOST", "localhost")
    try:
        PORT = int(environ.get("SERVER_PORT", "5555"))
    except ValueError:
        PORT = 5555
    app.run(HOST, PORT, ssl_context="adhoc")
Esempio n. 14
0
#!/usr/bin/python3
from FlaskWebProject import app

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=80, debug=False)
Esempio n. 15
0
"""
This script runs the FlaskWebProject application using a development server.
"""

from os import environ
from FlaskWebProject import app

if __name__ == '__main__':
    HOST = environ.get('SERVER_HOST', 'localhost')
    try:
        PORT = int(environ.get('SERVER_PORT', '5555'))
    except ValueError:
        PORT = 5555
    app.run(HOST, PORT, debug=True, ssl_context='adhoc')
Esempio n. 16
0
    if request.method == 'POST' and not late:
        file = request.files['file']
        good_form = check_form(request.form, file)
        if good_form['good']:
            request.form = clean_form(request.form)
            originalfilename = secure_filename(file.filename)
            filename = g.db.execute('select max(id) from food')
            filename = str(filename.fetchall()[0][0] + 1) + "." + originalfilename.rsplit('.', 1)[1]
            g.db.execute('insert into food (user, title, description, location, theme, url) values (?,?,?,?,?,?)',
        [session.get('user'), request.form['title'], request.form['description'], request.form['location'], get_theme(), filename])
            g.db.commit()
            file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
            return render_template('upload.html', submit=True, filename='images/' + filename, info=request.form)
        else:
            return render_template('upload.html', submit=True, error=good_form['error'])
    return render_template('upload.html', submit=False, late=late, start=app.config['START'])

@app.route('/feed')
def show_pics():
    if not session.get('logged_in'):
        return redirect(url_for('home'))
    theme = get_theme()
    command = 'select id, user, title, description, location, url from food where theme = "' + theme + '"'
    cur = g.db.execute(command)
    entries = [dict(id=row[0], user=row[1],title=row[2],desc=row[3],loc=row[4], url=row[5]) for row in cur.fetchall()]
    return render_template('show_entries.html', entries=entries, theme=theme, s=app.config['START'], e=app.config['END'], c=current_time())

if __name__=='__main__':
    app.run(debug=True)

Esempio n. 17
0
"""
This script runs the FlaskWebProject application using a development server.
"""

from os import environ
from flask  import url_for
from FlaskWebProject import app

if __name__ == '__main__':
    HOST = environ.get('SERVER_HOST', 'localhost')
    try:
        PORT = int(environ.get('SERVER_PORT', '5555'))
    except ValueError:
        PORT = 5555
    app.run(HOST, PORT, debug = True)
Esempio n. 18
0
import logging

import FlaskWebProject
from FlaskWebProject import app

if __name__ == '__main__':
    app.run(debug=True)