我有一个带有相关API和数据库的Web应用程序.
我想在API中使用相同的Django模型,但是它由不同的进程单独提供,因此我可以独立扩展它.
我也不需要API来提供静态资产或任何其他视图.
复杂的是我定义的路由有API,webapp共享根域:
http://domain.com/normal/application/stuff
http://domain.com/api/different/stuff
Run Code Online (Sandbox Code Playgroud)
另外我的Django应用程序依赖于彼此的模型和常量(所以两个不同的settings.py文件有不同INSTALLED_APPS并不能完全解决它).
我想有一种方法是我可以在我的Procfile中定义不同的进程,它只是启动Django应用程序,但是在其中一个进程中它可能有不同的环境变量?我不认为我可以改变每个Proc的环境heroku:config,我认为它实际上必须是Procfile中的指令.
任何人都有这方面的经验或见解吗?谢谢!
我正试图从Gunicorn切换到Heroku上的女服务员.在日志中,我不断收到Waitress的错误:
Error: Bad module 'cardisle'
Run Code Online (Sandbox Code Playgroud)
在我的procfile中,我有:
web: waitress-serve --port=$PORT cardisle.wsgi:application
Run Code Online (Sandbox Code Playgroud)
如果我删除.wsgi扩展名,我会收到一个不同的错误:
Error: Bad object name 'application'
Run Code Online (Sandbox Code Playgroud)
我已经尝试过changint对象名称,wsgifunc因为它在Waitress文档中,但没有运气.
任何帮助,将不胜感激.我有一个wsgi.py文件,其中包含以下内容:
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cardisle.settings")
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
Run Code Online (Sandbox Code Playgroud) 我正在app.py使用 Python 和 Flask运行我的应用程序。我正在尝试将它部署到 Heroku,并按照本教程中的步骤进行操作,包括制作 Procfile 和 requirements.txt。但是,每当我运行时heroku local,都会出现以下错误:
web.1 | [2015-09-26 17:36:32 -0400] [19422] [INFO] Starting gunicorn 19.3.0
web.1 | [2015-09-26 17:36:32 -0400] [19422] [INFO] Listening at: http://0.0.0.0:5000 (19422)
web.1 | [2015-09-26 17:36:32 -0400] [19422] [INFO] Using worker: sync
web.1 | [2015-09-26 17:36:32 -0400] [19425] [INFO] Booting worker with pid: 19425
web.1 | usage: gunicorn [-h] [--auth_host_name AUTH_HOST_NAME]
web.1 | gunicorn: error: unrecognized arguments: app:app
web.1 | [2015-09-26 17:36:32 -0400] [19425] [INFO] Worker …Run Code Online (Sandbox Code Playgroud) 我正在尝试设置一个Heroku-ready Flask应用程序,但我无法弄清楚如何打开日志记录.
如果没有Foreman,我可以创建一个helloworld应用程序,如Flask教程中所述:
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
app.logger.debug('A value for debugging')
app.logger.warning('A value for warning')
return "Hello World!"
if __name__ == "__main__":
app.run(debug=True)
Run Code Online (Sandbox Code Playgroud)
像这样开始:
python hello.py
Run Code Online (Sandbox Code Playgroud)
并登录stdout.
但是,当我遵循Heroku教程时,没有app.run线:
import os
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
app.logger.debug('A value for debugging')
app.logger.warning('A value for warning')
return 'Hello World!'
Run Code Online (Sandbox Code Playgroud)
所以我无法弄清楚如何在调试模式下运行和/或获取日志输出:
foreman start -p 5000
Run Code Online (Sandbox Code Playgroud)
Procfile:
web: gunicorn hello:app
Run Code Online (Sandbox Code Playgroud) 我是一个尝试制作 django 应用程序的新手,但不幸的是我的操作系统是 windows。Heroku 文档是为 linux 编写的,所以我无法获得足够的信息用于 Windows 7 上的应用程序开发。首先,如何使用 window cmd 制作 procfile?有没有命令语言翻译文档?(linux->windows)
我正在尝试将静态网站部署到Heroku,我正在努力如何正确设置Procfile.
我有下一个命令在服务器上运行:
npm installgulp build(将使用/public文件夹进行构建)http-server(将/public默认提供)我尝试过的:
web: npm install; gulp build; http-serverweb: npm install & gulp build & http-server我在 heroku procfile 中有一个很长的命令行,想把它分成多行。
使用像下面这样的反斜杠没有帮助......
简介:
web: java -Dserver.port=$PORT\
-Djavax.net.ssl.keyStoreType=pkcs12\
-Djavax.net.ssl.keyStore=$SOAP_SSL_KEYSTORE_PATH\
-Djavax.net.ssl.keyStorePassword=$SOAP_SSL_KEYSTORE_PASSWORD\
$JAVA_OPTS -jar pwr-mobile-rest-api-jar/target/pwr-mobile-rest-api-jar-runnable.jar
Run Code Online (Sandbox Code Playgroud)
如何格式化 procfile 以获得更好的外观?
我有三个流程Procfile.有时候,我只想跑两个.那是否有命令?
$ foreman start process_1 process_2
ERROR: "foreman start" was called with arguments ["process_1", "process_2"]
Usage: "foreman start [PROCESS]"
Run Code Online (Sandbox Code Playgroud) 我有一个简单的仅工作人员应用程序,它使用 heroku 的调度程序每天运行一次。然而,我注意到每次我推送代码并跟踪它到heroku创建一个Web进程,运行我的worker命令(两次!),然后在我的worker完成后声明它“崩溃”时,我都会得到额外的运行。
我的 Procfile 只有一项:
worker: npm start
Run Code Online (Sandbox Code Playgroud)
但是当我推送到heroku时,日志包括这一点:
-----> Discovering process types
Procfile declares types -> worker
Default types for Node.js -> web
Run Code Online (Sandbox Code Playgroud)
这是怎么回事以及如何禁用它?
您可以在https://github.com/nfriedly/vzw-bot上查看我的完整代码,并在https://travis-ci.org/nfriedly/vzw-bot/builds/83548651上查看最近推送的日志
这是我的项目的文件夹结构:
- Root-folder
.git
projecname
Procfile
pom.xml
Run Code Online (Sandbox Code Playgroud)
这是Procfile配置:
web: java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT --proxy-base-url https://projectname.herokuapp.com target/*.war
Run Code Online (Sandbox Code Playgroud)
我使用 Profile 从本地在 heroku 上部署项目:
cd projectname
git push heroku master
Run Code Online (Sandbox Code Playgroud)
但我在部署时遇到错误:
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/java.tgz
remote: Could not find a pom.xml file! Please check that it exists and is committed to Git.
remote:
remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
Run Code Online (Sandbox Code Playgroud)
据我了解,原因是:Heroku用于运行构建的根文件夹与包含is:maven的文件夹相同,文件位于文件夹中。.gitRoot-folderpom.xmlRoot-folder/projectname …
procfile ×10
heroku ×9
python ×3
django ×2
flask ×2
foreman ×2
node.js ×2
bash ×1
command-line ×1
gunicorn ×1
ruby ×1
shell ×1
spring-mvc ×1
translation ×1
waitress ×1