當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。