我想将在本地unix服务器上运行良好的应用程序部署到OpenShift云。我在那里注册并结帐git仓库。但是我不知道现在该怎么办。
该存储库中的应用程序具有以下结构:
/libs
/app.py
/setup.py
/wsgi
static/
application
但是我不知道应该在哪里复制我的项目,哪些文件应该在其中修改。我的项目结构如下
/domain.wsgi
/domain/
app.py
infrastructure.py
models/
static/
templates/
views/
domain.wsgi
import sys, os
current_dir = os.path.abspath(os.path.dirname(__file__))
sys.path.append(current_dir)
from domain.app import app as application
app.py
from infrastructure import app
import views.index
import views.login
import views.logout
import models.sa
Infrastructure.py
from flask import Flask, g
from flask.ext.sqlalchemy import SQLAlchemy
from models.sa import get_user_class, UserQuery
from models.database import db_session
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://.............'
db = SQLAlchemy(app)
## Set SQL Alchemy to automatically tear down
@app.teardown_request
def shutdown_session(exception=None):
db_session.remove()
# Instantiate authentication
User = get_user_class(db.Model)
# config
app.config.update(
DEBUG = True,
SECRET_KEY = 'xxxxxxxxx'
)
谢谢
最佳答案
您的文件放在wsgi文件夹下;请参阅有关如何将Flask应用程序部署到OpenShift的本教程:http://www.paasmag.com/2013/01/08/beginners-guide-to-writing-flask-apps-on-openshift/
关于python - 将Flask应用程序部署到OpenShift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17187097/