示例#1
0
from flask import Flask
from flask_sqlalchemy import SQLAlchemy # sql operations
from flask_static_compress import FlaskStaticCompress
from flask_compress import Compress
import os

app = Flask(__name__)

from app import routes

compress = FlaskStaticCompress(app)
Compress(app)

app.secret_key = "123459243c6949d1ae119b8d212345"
app.config['SQLALCHEMY_DATABASE_URI']='postgres://*****:*****@localhost/uber'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['SERVER_NAME'] = 'passeaquiapp.com'

db=SQLAlchemy(app)

class Problema(db.Model):
	id = db.Column(db.Integer, primary_key=True)
	lat = db.Column(db.Text)
	lng = db.Column(db.Text)
	description = db.Column(db.Text)
	gravidade =  db.Column(db.Integer)
	def __init__(self, lat, lng, description, gravidade):
		self.lat=lat
		self.lng=lng
		self.description = description
		self.gravidade=gravidade
示例#2
0
文件: athena.py 项目: sondaa/athena
  raise e

DEBUG = True
FLATPAGES_AUTO_RELOAD = DEBUG
FLATPAGES_EXTENSION = '.md'
FREEZER_REMOVE_EXTRA_FILES = False
FREEZER_BASE_URL = 'http://localhost/'

athena = Flask(__name__)
athena.config.from_object(__name__)
pages = FlatPages(athena)
freezer = Freezer(athena)
athena.jinja_env.comment_start_string = "{##}"
FlatPagesPandoc("markdown+raw_tex+yaml_metadata_block",
  athena, pre_render=True)
compress = FlaskStaticCompress(athena)

def make_external(url):
  return urljoin(request.url_root, url)

@athena.route("/feed.atom")
def recent_feed():
  feed = AtomFeed(config.config["title"],
      feed_url = request.url_root,
      url = request.url_root,
      subtitle = config.config["title"] + " Atom Feed"
    )

  for page in pages:
    if not page.meta.get("ispage"):
      feed.add(page["title"],