当前位置: 首页>>代码示例>>Python>>正文


Python FlaskAPI.config['SQLALCHEMY_DATABASE_URI']方法代码示例

本文整理汇总了Python中flask.ext.api.FlaskAPI.config['SQLALCHEMY_DATABASE_URI']方法的典型用法代码示例。如果您正苦于以下问题:Python FlaskAPI.config['SQLALCHEMY_DATABASE_URI']方法的具体用法?Python FlaskAPI.config['SQLALCHEMY_DATABASE_URI']怎么用?Python FlaskAPI.config['SQLALCHEMY_DATABASE_URI']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flask.ext.api.FlaskAPI的用法示例。


在下文中一共展示了FlaskAPI.config['SQLALCHEMY_DATABASE_URI']方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: FlaskAPI

# 需要导入模块: from flask.ext.api import FlaskAPI [as 别名]
# 或者: from flask.ext.api.FlaskAPI import config['SQLALCHEMY_DATABASE_URI'] [as 别名]
    return py_proc % (Path(proj_dir,core_base_dir,core_file),operation,scheme_id)

import sys
sys.path.append(str(Path(proj_dir,core_base_dir))+ os.sep)

from flask import Flask,request, Response
from auth import requires_auth
from DateConverter import DateConverter
from flask_sqlalchemy import SQLAlchemy
from data.scheme import scheme
from data.sql import *
from flask.ext.api import FlaskAPI, status, exceptions

app = FlaskAPI(__name__) # Browsable Web APIs for Flask
#app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///../voystock.db'
app.url_map.converters['datetime'] = DateConverter

db = SQLAlchemy(app,session_options = { 'expire_on_commit':False })

#import actions
import SaarCore as actions

# Make the WSGI interface available at the top level so wfastcgi can get it.
wsgi_app = app.wsgi_app

@requires_auth
@app.route('/init')
def init():
    """Renders a sample page."""
    try:
开发者ID:jeffreye,项目名称:Saar,代码行数:33,代码来源:app.py

示例2: Path

# 需要导入模块: from flask.ext.api import FlaskAPI [as 别名]
# 或者: from flask.ext.api.FlaskAPI import config['SQLALCHEMY_DATABASE_URI'] [as 别名]
from flask.ext.api import FlaskAPI, status, exceptions
from flask.ext.api.decorators import set_renderers
from flask.ext.api.renderers import HTMLRenderer
from flask.ext.api.exceptions import APIException
from flask.ext.sqlalchemy import SQLAlchemy

from sqlalchemy import Column, Integer, String, DateTime, Boolean, desc
from unipath import Path

import bleach
import tweepy

TEMPLATE_DIR = Path(__file__).ancestor(1).child("templates")

app = FlaskAPI(__name__, template_folder=TEMPLATE_DIR)
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['DATABASE_URL']
db = SQLAlchemy(app)

CONSUMER_KEY = os.environ['CONSUMER_KEY']
CONSUMER_SECRET = os.environ['CONSUMER_SECRET']
ACCESS_KEY  = os.environ['ACCESS_KEY']
ACCESS_SECRET = os.environ['ACCESS_SECRET']
TWITTER_USER = os.environ['TWITTER_USER']

auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
api = tweepy.API(auth)


class Note(db.Model):
开发者ID:Ogreman,项目名称:tweetboard,代码行数:32,代码来源:app.py

示例3: FlaskAPI

# 需要导入模块: from flask.ext.api import FlaskAPI [as 别名]
# 或者: from flask.ext.api.FlaskAPI import config['SQLALCHEMY_DATABASE_URI'] [as 别名]
from flask.ext.api.exceptions import APIException, ParseError
from flask.ext.sqlalchemy import SQLAlchemy
from wtforms import TextField
from Crypto.PublicKey import RSA
from Crypto import Random
import base64
import time
import datetime
import os
import re
import logging

random_gen = Random.new().read

app = FlaskAPI(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ[ 'TIMELOCK_DB_URI' ]
db = SQLAlchemy(app)

@app.before_first_request
def initialize_app():
    db.create_all()

class TimeLock( db.Model ):
    __tablename__ = "timelocks"
    release_time = db.Column( db.DateTime, primary_key = True )
    priv_key = db.Column( db.String(4096) )
    pub_key = db.Column( db.String(1024) )

class MissingTimestamp( APIException ):
    status_code = 400
    detail = "Please supply a timestamp. Example: http://timelock.me/1397252609"
开发者ID:jaibot,项目名称:timelock,代码行数:33,代码来源:app.py


注:本文中的flask.ext.api.FlaskAPI.config['SQLALCHEMY_DATABASE_URI']方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。