1

如何配置 Genie 进行生产?它正在为开发环境创建应用程序:

Active env: DEV

完整日志:

[root@srvr0 ~]# julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.6.4 (2021-11-19)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using Genie

julia> Genie.newapp_mvc("WatchTonight")
    Updating registry at `~/.julia/registries/General`
   Resolving package versions...
  No Changes to `~/.julia/environments/v1.6/Project.toml`
  No Changes to `~/.julia/environments/v1.6/Manifest.toml`
Please choose the DB backend you want to use: 
1. SQLite
2. MySQL
3. PostgreSQL
4. Other
Input 1, 2, 3 or 4 and press ENTER to confirm

4
Please input DB adapter (ex: Oracle, ODBC, JDBC, etc)

Oracle
  Activating environment at `~/Project.toml`
┌ Error: Pkg.Types.PkgError("The following package names could not be resolved:\n * SearchLightOracle (not found in project, manifest or registry)\n")
└ @ Genie.Generator ~/.julia/packages/Genie/fMBsZ/src/Generator.jl:503
[ Info: Done! New app created at /root/WatchTonight
[ Info: Changing active directory to /root/WatchTonight
    /tmp/jl_Z2oGzp/WatchTonight/Project.toml
[ Info: Project.toml has been generated
[ Info: Installing app dependencies
  Activating environment at `~/WatchTonight/Project.toml`
   Resolving package versions...
   Installed Crayons ────────── v4.1.0
   Installed LoweredCodeUtils ─ v2.2.0
   Installed JuliaInterpreter ─ v0.9.0
   Installed Revise ─────────── v3.3.1
    Updating `~/WatchTonight/Project.toml`
  [c43c736e] + Genie v4.7.1
  [6d011eab] + Inflector v1.0.1
  [e6f89c97] + LoggingExtras v0.4.7
  [739be429] + MbedTLS v1.0.3
  [ade2ca70] + Dates
  [56ddb016] + Logging
    Updating `~/WatchTonight/Manifest.toml`
  [c7e460c6] + ArgParse v1.1.4
  [00ebfdb7] + CSTParser v3.3.0
  [da1fd8a2] + CodeTracking v1.0.6
  [a80b9123] + CommonMark v0.8.5
  [34da2185] + Compat v3.41.0
  [a8cc5b0e] + Crayons v4.1.0
  [864edb3b] + DataStructures v0.18.11
  [8f5d6c58] + EzXML v1.1.0
  [48062228] + FilePathsBase v0.9.17
  [c43c736e] + Genie v4.7.1
  [cd3eb016] + HTTP v0.9.17
  [77172c1b] + HttpCommon v0.5.0
  [6d011eab] + Inflector v1.0.1
  [83e8ac13] + IniFile v0.5.0
  [692b3bcd] + JLLWrappers v1.3.0
  [682c06a0] + JSON v0.21.2
  [0f8b85d8] + JSON3 v1.9.2
  [98e50ef6] + JuliaFormatter v0.20.5
  [aa1ae85d] + JuliaInterpreter v0.9.0
  [e6f89c97] + LoggingExtras v0.4.7
  [6f1432cf] + LoweredCodeUtils v2.2.0
  [739be429] + MbedTLS v1.0.3
  [39ec1447] + Millboard v0.2.5
  [49dea1ee] + Nettle v0.5.1
  [4d1e1d77] + Nullables v1.0.0
  [bac558e1] + OrderedCollections v1.4.1
  [69de0a69] + Parsers v2.1.3
  [21216c6a] + Preferences v1.2.3
  [92933f4c] + ProgressMeter v1.7.1
  [189a3867] + Reexport v1.2.2
  [ae029012] + Requires v1.2.0
  [295af30f] + Revise v3.3.1
  [6c6a2e73] + Scratch v1.1.0
  [69024149] + StringEncodings v0.3.5
  [856f2bd8] + StructTypes v1.8.1
  [b718987f] + TextWrap v1.0.1
  [0796e94c] + Tokenize v0.5.21
  [30578b45] + URIParser v0.4.1
  [5c2747f8] + URIs v1.3.0
  [856ac37a] + UrlDownload v1.0.0
  [a637dc6b] + VersionCheck v0.2.0
  [ddb6d928] + YAML v0.4.7
  [94ce4f54] + Libiconv_jll v1.16.1+1
  [4c82536e] + Nettle_jll v3.7.2+0
  [02c8fc9c] + XML2_jll v2.9.12+0
  [0dad84c5] + ArgTools
  [56f22d72] + Artifacts
  [2a0f44e3] + Base64
  [ade2ca70] + Dates
  [8bb1440f] + DelimitedFiles
  [8ba89e20] + Distributed
  [f43a241f] + Downloads
  [7b1f6079] + FileWatching
  [b77e0a4c] + InteractiveUtils
  [b27032c2] + LibCURL
  [76f85450] + LibGit2
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [56ddb016] + Logging
  [d6f4376e] + Markdown
  [a63ad114] + Mmap
  [ca575930] + NetworkOptions
  [44cfe95a] + Pkg
  [de0858da] + Printf
  [3fa0cd96] + REPL
  [9a3f8284] + Random
  [ea8e919c] + SHA
  [9e88b42a] + Serialization
  [1a1011a3] + SharedArrays
  [6462fe0b] + Sockets
  [2f01184e] + SparseArrays
  [10745b16] + Statistics
  [fa267f1f] + TOML
  [a4e569a6] + Tar
  [8dfed614] + Test
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode
  [781609d7] + GMP_jll
  [deac9b47] + LibCURL_jll
  [29816b5a] + LibSSH2_jll
  [c8ffd9c3] + MbedTLS_jll
  [14a3606d] + MozillaCACerts_jll
  [83775a58] + Zlib_jll
  [8e850ede] + nghttp2_jll
  [3f19e933] + p7zip_jll
Precompiling project...
  ✓ JuliaInterpreter
  ✓ Crayons
  ✓ CommonMark
  ✓ LoweredCodeUtils
  ✓ JuliaFormatter
  ✓ Revise
  ✓ Genie
  9 dependencies successfully precompiled in 120 seconds (41 already precompiled)
  7 dependencies precompiled but different versions are currently loaded. Restart julia to access the new versions
   Resolving package versions...
    Updating `~/WatchTonight/Project.toml`
  [340e8cb6] + SearchLight v2.0.1
    Updating `~/WatchTonight/Manifest.toml`
  [9a962f9c] + DataAPI v1.9.0
  [a93c6f00] + DataFrames v1.3.1
  [e2d170a0] + DataValueInterfaces v1.0.0
  [59287772] + Formatting v0.4.2
  [41ab1584] + InvertedIndices v1.1.0
  [82899510] + IteratorInterfaceExtensions v1.0.0
  [e1d29d7a] + Missings v1.0.2
  [2dfb63ee] + PooledArrays v1.4.0
  [08abe8d2] + PrettyTables v1.3.1
  [340e8cb6] + SearchLight v2.0.1
  [a2af1166] + SortingAlgorithms v1.0.1
  [3783bdb8] + TableTraits v1.0.1
  [bd369af6] + Tables v1.6.1
  [9fa8497b] + Future
Precompiling project...
  ✓ LoweredCodeUtils
  ✓ JuliaFormatter
  ✓ Revise
  ✓ Genie
  6 dependencies successfully precompiled in 105 seconds (57 already precompiled)
  4 dependencies precompiled but different versions are currently loaded. Restart julia to access the new versions
Please choose the DB backend you want to use: 
1. SQLite
2. MySQL
3. PostgreSQL
4. Other
Input 1, 2, 3 or 4 and press ENTER to confirm

4
Please input DB adapter (ex: Oracle, ODBC, JDBC, etc)

Oracle
  Activating environment at `~/WatchTonight/Project.toml`
┌ Error: Pkg.Types.PkgError("The following package names could not be resolved:\n * SearchLightOracle (not found in project, manifest or registry)\n")
└ @ Genie.Generator ~/.julia/packages/Genie/fMBsZ/src/Generator.jl:503
[ Info: Installing dependencies for unit tests
  Activating new environment at `~/WatchTonight/test/Project.toml`
   Resolving package versions...
    Updating `~/WatchTonight/test/Project.toml`
  [8dfed614] + Test
    Updating `~/WatchTonight/test/Manifest.toml`
  [2a0f44e3] + Base64
  [b77e0a4c] + InteractiveUtils
  [56ddb016] + Logging
  [d6f4376e] + Markdown
  [9a3f8284] + Random
  [9e88b42a] + Serialization
  [8dfed614] + Test
  Activating environment at `~/WatchTonight/Project.toml`
[ Info: Starting your brand new Genie app - hang tight!
[ Info: Precompiling WatchTonight [93f46181-df21-4b6e-b7cd-33e5e979776f]

 _____         _
|   __|___ ___|_|___
|  |  | -_|   | | -_|
|_____|___|_|_|_|___|

| Web: https://genieframework.com
| GitHub: https://github.com/genieframework/Genie.jl
| Docs: https://genieframework.github.io/Genie.jl/dev
| Gitter: https://gitter.im/essenciary/Genie.jl
| Twitter: https://twitter.com/GenieMVC

Active env: DEV


Ready! 

┌ Info: 2022-01-06 10:38:26 
└ Web Server starting at http://127.0.0.1:8000 
4

1 回答 1

1

您有 2 个简单的选择:

1/ 在 OS 终端,启动 Genie 应用程序时,传递GENIE_ENV="prod"环境变量,如下所示:

$> GENIE_ENV="prod" bin/repl

config/env/global.jl2/ 通过编辑文件并添加以下行,默认将应用程序切换到 PROD :

ENV["GENIE_ENV"] = "prod"
于 2022-01-17T20:10:53.800 回答