Exemple #1
0
def main(port=80):
    from sys import argv

    from website import app as app

    try:
        app.run(host='0.0.0.0', port=argv[1])
    except IndexError:
        stars = '\n' + (20 * '*') + '\n'
        print(stars + 'No port found, using default port %s' % port + stars)
        app.run(host='0.0.0.0', port=port)
Exemple #2
0
def test(args):
	exec_dir = os.path.join(args.repo,"output",args.target)
	if args.target == "freecad":
		freecad_process = Popen(["freecad","-M","."],cwd=exec_dir)
		freecad_process.wait()
	elif args.target == "openscad":
		freecad_process = Popen(["openscad"],cwd=exec_dir)
		freecad_process.wait()
	elif args.target == "website":
		import website
		from website import app
		extra_files = []
		blog_path = os.path.join(args.repo,"website","blog","posts")
		for filename in listdir(blog_path):
			if filename.startswith('.'):
				continue
			extra_files.append(os.path.join(blog_path,filename))

		doc_path = os.path.join(args.repo,"website","docs","sources")
		for dirpath,_,filenames in walk(doc_path):
			for filename in filenames:
				if filename.startswith('.'):
					continue
				extra_files.append(os.path.join(dirpath,filename))

		trans_path = os.path.join(args.repo,"translations")
		for dirpath,_,filenames in walk(trans_path):
			for filename in filenames:
				if filename.endswith('.mo'):
					extra_files.append(os.path.join(dirpath,filename))

		#templates
		for dirpath,_,filenames in walk(args.repo):
			if os.path.basename(dirpath) == "templates":
				for filename in filenames:
					extra_files.append(os.path.join(dirpath,filename))



		app.run(debug=True,extra_files=extra_files)
Exemple #3
0
def test(args):
    exec_dir = os.path.join(args.repo, "output", args.target)
    if args.target == "freecad":
        freecad_process = Popen(["freecad", "-M", "."], cwd=exec_dir)
        freecad_process.wait()
    elif args.target == "openscad":
        freecad_process = Popen(["openscad"], cwd=exec_dir)
        freecad_process.wait()
    elif args.target == "website":
        import website
        from website import app
        extra_files = []
        blog_path = os.path.join(args.repo, "website", "blog", "posts")
        for filename in listdir(blog_path):
            if filename.startswith('.'):
                continue
            extra_files.append(os.path.join(blog_path, filename))

        doc_path = os.path.join(args.repo, "website", "docs", "sources")
        for dirpath, _, filenames in walk(doc_path):
            for filename in filenames:
                if filename.startswith('.'):
                    continue
                extra_files.append(os.path.join(dirpath, filename))

        trans_path = os.path.join(args.repo, "translations")
        for dirpath, _, filenames in walk(trans_path):
            for filename in filenames:
                if filename.endswith('.mo'):
                    extra_files.append(os.path.join(dirpath, filename))

        #templates
        for dirpath, _, filenames in walk(args.repo):
            if os.path.basename(dirpath) == "templates":
                for filename in filenames:
                    extra_files.append(os.path.join(dirpath, filename))

        app.run(debug=True, extra_files=extra_files)
Exemple #4
0
import website.app as a

if __name__ == '__main__':

    a.run()
import sys

from flask import render_template, request
from website import app, views
from flask_frozen import Freezer

if __name__ == '__main__':
    if len(sys.argv) > 1 and sys.argv[1] == "build":
        freezer = Freezer(app)
        freezer.freeze()
    else:
        app.run(debug=True, host="192.168.178.14", port=8000)
Exemple #6
0
import argparse

from website import app
from website import routes

if __name__ == "__main__":
	parser = argparse.ArgumentParser()
	parser.add_argument("-d", dest="debug", type=bool)
	args = parser.parse_args()

	if args.debug:
		app.debug = True

	app.run(threaded=True)
Exemple #7
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from website import app

if __name__ == '__main__':
    app.run(host=app.config['SERVER_ADDRESS'],
            debug=app.config['DEBUG'],
            port=app.config['SERVER_PORT'])
Exemple #8
0
  response = urllib2.urlopen(req)

  return get_facebook_data()

@app.route("/facebook_redirect",methods=['GET','POST'])
def redir():
  print request.args.items()
  print request.form.itmes()
  return "HELLO"

@app.route("/", methods=['GET', 'POST'])
def combined_all():

  mobile = False
  browser = request.user_agent.browser
  version = request.user_agent.version and int(request.user_agent.version.split('.')[0])
  platform = request.user_agent.platform
  uas = request.user_agent.string

  if platform:
    if platform in ['iphone','android'] \
    or (platform == 'windows' and re.search('Windows Phone OS', uas)) \
    or (re.search('BlackBerry', uas)):
       mobile = True
     

  return render_template('combined_pages.html', data=get_user_data(),github_data=get_github_data(),user_data=dict(parser.items('user')),facebook_data=get_facebook_data(),mobile=mobile,gvoice_widget = parser.get('user','gvoice_widget_id'))

if __name__ == '__main__':
  app.run(debug=True,host='0.0.0.0')
Exemple #9
0
# this file runs the application and allows you to view the application from the web browser 

from website import app
import os

if __name__ == '__main__':
    app.run(debug=True, port=8000)   
Exemple #10
0
"""
Start the Flask app
"""

from website import app

if __name__ == '__main__':
    app.run(debug=True)
Exemple #11
0
def run():
    app.run(debug=True)
"""
This script runs the website application using a development server.
"""

from os import environ
from website 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)
Exemple #13
0
import os

from website import app

#os.environ["FLASK_DEV_SERVER"] = "true"

# Bind to PORT if defined, otherwise default to 5000.
port = int(os.environ.get('PORT', 5000))
app.run(debug=False, host='0.0.0.0', port=port)
Exemple #14
0
__author__ = 'Plommonsorbet'

from website import app
app.run(

    debug=True,
    port=1111

)
from website import app

if __name__=='__main__':
    app.run(host='0.0.0.0', port=3000)
Exemple #16
0
from website import app
import os

if __name__ == "__main__":
    port = int(os.environ.get("PORT", 5000))
    app.run(host='0.0.0.0', port=port)
Exemple #17
0
### File to run a local debug server
from website import app
app.run(host='0.0.0.0', port=8005, debug=True)
        own_plants[p['id']] = AutomaticWateringSystem(uuid=p['id'],
                                                      name=p[Database.TABLE_OWN_PLANT_NAME],
                                                      temperature_pin=p[Database.TABLE_OWN_PLANT_TEMPERATURE_PIN],
                                                      magnetic_valve_pin=p[Database.TABLE_OWN_PLANT_MAGNETIC_VALVE_PIN],
                                                      moisture_pin=p[Database.TABLE_OWN_PLANT_MOISTURE_PIN],
                                                      gpio_debug=False,
                                                      debug=True)

    ValveQueue = WateringQueue(True)

    reload_flask = False
    # if environ.get('RELOAD_FLASK') is not None:
    #     reload_flask = True

    app = app.create_app(DevelopmentConfig)
    app.run(host='0.0.0.0', use_reloader=reload_flask)

    for a in own_plants:
        a.cleanup()

    print 'CLEEEEEANUP'
    # gpio.digitalWrite(pump_pin, gpio.LOW)
    # gpio.cleanup()

    # # # NOTE: There will exist one class PER temperature sensor
    # # temperature_pin = 0
    # # GetTemperature = Temperature(analogPins.get(temperature_pin), 30)
    # #
    # # # NOTE: There will exist one class PER magnetic valve
    # # magnetic_valve_pin = 6
    # # ChiliMagneticValve = MagneticValve(digitalPins.get(magnetic_valve_pin), 'CHILI #1', True)
__author__ = 'isak.johansson'


from website import app

app.run(debug=True, host='0.0.0.0', port=3333
)

Exemple #20
0
from website import app
if __name__ == '__main__':
    app.run(debug=True, use_reloader=True)
Exemple #21
0
from website import app

app.run('0.0.0.0', debug=True)
Exemple #22
0
#!/usr/bin/env python
#
# Copyright 2014 Ravello Systems, Inc.
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#    http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from website import app
app.run(host='0.0.0.0', port=8080)
Exemple #23
0
from website import app, db

if __name__ == '__main__':
    db.create_all()
    app.run(host='0.0.0.0', port=80)
    HOST = environ.get('SERVER_HOST', 'localhost')
    #   HOST = environ.get('SERVER_HOST', '0.0.0.0')
    #   HOST = environ.get('SERVER_HOST', '')
    PORT = int(environ.get('SERVER_PORT', '5000'))

    if (enableLiveReload):
        app.debug = True
        liveReloadServer = Server(app.wsgi_app)
        #  certLocation = "website/certs/"

        # server.watch
        liveReloadServer.watch('website/')
        liveReloadServer.watch('website/templates/')
        liveReloadServer.serve(port=PORT, host=HOST)
    else:
        app.run(HOST, PORT, debug=False)

#   socketio.run(app, port=9090)

#  server = Server(app.wsgi_app)
#  certLocation = "website/certs/"
#  app.debug = True

# server.watch
#  server.watch('website/')
#  server.watch('website/templates/')

# server.serve(port=PORT, ssl_ctx=ssl_ctx)

# https://localhost:50603
# pass in debug=false since debugging with Visual Studio code.
Exemple #25
0
import sys
from website import app, models, init_for
init_for('dev')
models.db.create_all()

try:
    port = int(sys.argv[1])
except (IndexError, ValueError):
    port = 3000
app.run('0.0.0.0', port=port, debug=True)
from website import app

app.config['DEBUG'] = True

app.run(port=5002)
Exemple #27
0
# coding: utf8

__author__ = 'neodooth'

import logging
logging.getLogger('requests').setLevel(logging.WARNING)
logging.getLogger('werkzeug').setLevel(logging.WARNING)

from config import ROLE

logging.basicConfig(
    filename=ROLE + '.log',
    level=logging.INFO,
    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')

if ROLE == 'website':
    from website import app
else:
    from downloader import app

logging.info('starting %s' % ROLE)
app.run(debug=True,
        use_reloader=False,
        threaded=True,
        host='0.0.0.0',
        port=2938)
Exemple #28
0
from website import app as application

if __name__ == "__main__":
    application.run()
Exemple #29
0
from website import app

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=6969, debug=True)
Exemple #30
0
from website import app

if __name__ == "__main__":
    print("schwierig")
    app.run(host='0.0.0.0')
Exemple #31
0
from website import app

if __name__ == "__main__":
    app.run(debug=True, port=5001, use_reloader=False)
from website import app

app.run(host='0.0.0.0', port=5000, debug=False)
Exemple #33
0
# -*- coding: utf-8 -*-
from flask.ext.scss import Scss
from website import app

if __name__ == '__main__':
    app.debug = True
    Scss(app, static_dir='static', asset_dir='assets')
    app.run(port=4002, debug=True)
from website import app

if __name__ == '__main__':
    app.run(port=80, debug=True)
Exemple #35
0
from website import app
from flask import Flask

app.run(port=5000, host='0.0.0.0', debug=True)
Exemple #36
0
    return send_from_directory(UPLOAD_FOLDER, filename)


@app.route('/avatar/<filename>')
def uploaded_avatar(filename):
    if filename == 'default_avatar.jpg':
        return send_from_directory(STATIC_FOLDER, 'img/default_avatar.jpg')
    size = request.args.get('size')
    if size:
        (base_name, ext_name) = filename.rsplit('.', 1)
        if ext_name in PIC_EXTENSIONS:
            ori_file = os.path.join(AVATAR_FOLDER, filename)
            thumb_filename = "{0:s}_{1:s}.jpg".format(base_name, size)
            thumb_dir = os.path.join(UPLOAD_FOLDER, "thumb")
            file_path = os.path.join(UPLOAD_FOLDER, "thumb/{0:s}".format(thumb_filename))
            if not os.path.exists(file_path):
                if not os.path.exists(thumb_dir):
                    os.mkdir(thumb_dir)
                im = Image.open(ori_file)
                (x, y) = im.size
                y_s = int(size)
                x_s = x * y_s / y
                out = im.resize((x_s, y_s), Image.ANTIALIAS)
                out.save(file_path, "JPEG")
            return send_from_directory(thumb_dir, thumb_filename)
    return send_from_directory(AVATAR_FOLDER, filename)


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5001, debug=DEBUG)
Exemple #37
0
from website import app
import os

app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 5000)))
Exemple #38
0
from website import app

if __name__ == "__main__":
    app.run(threaded=True)
Exemple #39
0
def run():
    app.run(debug=True)
Exemple #40
0
from website import app

if __name__ == "__main__":
    app.run(debug=True, host='0.0.0.0')
Exemple #41
0
from website import app
app.run(host='0.0.0.0', port=8000, debug=True)
Exemple #42
0
        db.session.add(t)
        db.session.add(p)
        t.tags.append(p)

        db.session.commit()

    for a in request.form.keys():
        print(a, request.form[a])
        return render_template("contact.html",
                               title='form sent!',
                               usercomment=p)
    else:
        title = 'contact form'
        return render_template("contact.html", title=title)


def initdb():
    """ Create database """
    db.create_all()
    # posts = buildPosts()
    print('Successful')


@login_manager.user_loader
def load_user(userid):
    return User.query.get(int(userid))


if __name__ == '__main__':
    app.run(port=8080)
"""
This script runs the website application using a development server.
"""

from os import environ
from website 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)
Exemple #44
0
from website import app

if __name__ == "__main__":
    app.run(debug=False)

# python
# from website import db
# db.create_all()
# exit()

# .\env\Scripts\activate
# python run.py
Exemple #45
0
from website import app

if __name__ == '__main__':
    app.debug = True
    app.run(port=3000)
Exemple #46
0
from website import app

if __name__ == '__main__':
    app.run(port="3000", debug=True)  #f
Exemple #47
0
from website import app

if __name__=="__main__":
    app.run()
Exemple #48
0
from website import app

app.run(host='0.0.0.0', port=5000)
Exemple #49
0
from website import app

if __name__ == '__main__':
    # app.run(port=5000, host='0.0.0.0', debug=True, )
    # static_files just define a new set of paths for the application. you can use any of them later. it is good if your
    # static files are split in multiple places
    app.run(
        port=5000,
        host='0.0.0.0',
        debug=True,
        # static_files={'/demo/static': '/home/disooqi/projects/dial-diac/website/demo/static'},
    )
from website import app
#from settings import Development

app.config.from_object('settings.Development')

if __name__ == '__main__':
    app.run()
else:
    raise RuntimeError('This script should be run directly. DO NOT USE FOR WSGI')
Exemple #51
0
from website import app

if __name__ == "__main__":
    # reminder to turn off Debug at the end
    app.run(debug=True)
Exemple #52
0
from website import app

app.run('0.0.0.0', debug=True)