lein new compojure mongotest
lein 2.0 と Procfileを使用して compojure アプリを作成しましたweb: lein ring server-headless $PORT
。これはうまくいきましたが、今追加すると
(def mongolab-url (System/getenv "MONGOLAB_URI"))
(println "mongolab-url")
(println mongolab-url)
(mg/connect-via-uri! mongolab-url)
git push heroku master
私がHerokuを試すと、最終的に私に与えます
Compiling mongotest.handler
mongolab-url
nil
Exception in thread "main" java.lang.NullPointerException, compiling:(handler.clj:13:1)
... 25 more
Compilation failed: Subprocess failed
Error encountered performing task 'compile' with profile(s): 'production'
Suppressed exit
! Failed to build.
! Push rejected, failed to compile Clojure (Leiningen 2) app
これらの行を の最上位に追加しましたhandler.clj
。接続が で作成されていることがわかる古いドキュメントの一部ですが、生成されたアプリには (私が見つけた) もうmain
存在しないため、古いバージョンの compojure 用である必要があります。main
現在のバージョンではどこで接続を確立する必要がありますか? (または、私のプロファイルが正しくありませんか?)
(はい、MONGOLAB_URI
で定義されていheroku config
ます)