我试图有一些变量属性值,并使用Maven配置文件来获得正确的输出.我已经为我的hibernate xml,log4j.properties做了这个,并没有问题.
所以它在项目#1中对我有用,我在/ src/main/resources下有一堆文件.我在maven中设置了属性和资源过滤,如下所示:
<properties>
<log.level>DEBUG</log.level>
</properties>
<profiles>
<profile>
<id>production</id>
<properties>
<log.level>INFO</log.level>
</properties>
</profile>
</profiles>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
Run Code Online (Sandbox Code Playgroud)
以上工作没有问题.但是,在我的项目#2中 - 我有一些具有可变属性的文件,但是它们位于/ src/main/webapp/WEB-INF下 - 我做的与上面相同,除了指向WEB-INF的目录它不起作用.我在项目#2上尝试将文件放在/ src/main/resources下并且它工作正常.
所以在我看来资源过滤有问题,当文件在/ src/main/webapp/WEB-INF下,但我需要文件在那里,所以它在生成战争时进入WEB-INF文件夹.
有没有人有关于如何做到这一点的指针?
以下是pom.xml中的以下snipet不起作用(资源过滤完全被忽略)
<properties>
<wsdl.url>http://stage/wsdl-url</wsdl.url>
</properties>
<profiles>
<profile>
<id>production</id>
<properties>
<wsdl.url>http://prod/wsdl-url</wsdl.url>
</properties>
</profile>
</profiles>
<build>
<resources>
<resource>
<directory>src/main/webapp/WEB-INF</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
Run Code Online (Sandbox Code Playgroud) 我对 elixir 和 phoenix(和 ubuntu)很陌生,并且一直在努力让自己启动并运行 Web 开发。使用创建新的凤凰应用程序时
mix phoenix.new webapp
Run Code Online (Sandbox Code Playgroud)
我从终端收到以下错误
Fetch and install dependencies? [Yn] y
* running mix deps.get
* error command failed to execute, please run the following command again after installation: "mix deps.get"
* running npm install && node node_modules/brunch/bin/brunch build
* error command failed to execute, please run the following command again after installation: "npm install && node node_modules/brunch/bin/brunch build"
Run Code Online (Sandbox Code Playgroud)
和跑步时 mix deps.get
结果错误信息是
** (Mix) No package with name phoenix_ecto (from: mix.exs) in registry …Run Code Online (Sandbox Code Playgroud) 我目前正在使用Phoenix应用程序,在修改/config/*文件时遇到了这个问题.
目前,我的Endpoint的配置包含以下内容:
config :my_app, MyApp.Endpoint,
http: [port: 8080],
url: [host: "example.com", port: 80]
...
Run Code Online (Sandbox Code Playgroud)
在阅读了两个文件:http配置和:url配置后,我仍然不清楚:
每个是什么:端口配置用于它们和它们有何不同?
当试图运行花好月圆(凤凰城),使用PostgreSQL数据库的Web应用程序托管的3 次党" 数据库,作为一种服务 "(Azure数据库PostgreSQL的).
我们尝试启动应用程序时mix phoenix.server看到以下错误:
[info] Running Pxblog.Endpoint with Cowboy using http://localhost:4000
[error] GenServer #PID<0.247.0> terminating
** (FunctionClauseError) no function clause matching in Postgrex.Messages.decode_fields/1
(postgrex) lib/postgrex/messages.ex:339: Postgrex.Messages.decode_fields("")
(postgrex) lib/postgrex/messages.ex:344: Postgrex.Messages.decode_fields/1
(postgrex) lib/postgrex/messages.ex:344: Postgrex.Messages.decode_fields/1
(postgrex) lib/postgrex/messages.ex:131: Postgrex.Messages.parse/3
(postgrex) lib/postgrex/protocol.ex:1842: Postgrex.Protocol.msg_decode/1
(postgrex) lib/postgrex/protocol.ex:1816: Postgrex.Protocol.msg_recv/3
(postgrex) lib/postgrex/protocol.ex:560: Postgrex.Protocol.auth_recv/3
(postgrex) lib/postgrex/protocol.ex:475: Postgrex.Protocol.handshake/2
(db_connection) lib/db_connection/connection.ex:134: DBConnection.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
Run Code Online (Sandbox Code Playgroud)
通过调查我们意识到错误是因为Azure PostgreSQL服务Enforce SSL Connection设置为Enabled(bydefault …
我有一个Elixir/Phoenix应用程序,根据域名(也称为租户)做出不同反应.
租户具有特定的区域设置,例如"fr_FR","en_US"等.
我想根据当前的语言环境翻译路由器的URI :
# EN
get "/classifieds/new", ClassifiedController, :new
# FR
get "/annonces/ajout", ClassifiedController, :new
Run Code Online (Sandbox Code Playgroud)
到目前为止,我认为可以做类似的事情(伪代码):
if locale() == :fr do
scope "/", Awesome.App, as: :app do
pipe_through :browser # Use the default browser stack
get "/annonces/ajout", ClassifiedController, :new
end
else
scope "/", Awesome.App, as: :app do
pipe_through :browser # Use the default browser stack
get "/classifieds/new", ClassifiedController, :new
end
end
Run Code Online (Sandbox Code Playgroud)
由于路由器是在服务器启动期间编译的,因此它不起作用,因此您没有当前连接的上下文(区域设置,域,主机等).
到目前为止,我的解决方案(可行)是创建两个带有两个别名的作用域:
scope "/", Awesome.App, as: :fr_app do
pipe_through :browser # Use the default browser stack …Run Code Online (Sandbox Code Playgroud) 我需要创建一个定义长度的字符串.在红宝石中,我会使用:
str = 'a' * 5
我如何在灵药中完成同样的事情?
Repo.insert(changeset)
Run Code Online (Sandbox Code Playgroud)
返回{:ok, struct},但 struct 没有预加载的关联。我是否被迫选择查询来预加载其关联?或者我可以以某种方式避免无用的查询吗?
我正在尝试使用十六进制打包的CSV。
我将依赖添加到mix.exs中,如下所示:
def application do
[applications: [:logger, :csv]]
end
defp deps do
[
{:csv, "~> 1.4.2"}
]
Run Code Online (Sandbox Code Playgroud)
然后,我运行mix deps.get和mix deps.compile在终端。
依赖文件夹显示在deps文件夹中。
在尝试使用依赖项之前,一切似乎都还不错。我收到此错误:
“未加载模块CSV,无法找到”
我试过一个简单的用途,而无需像这样导入:
File.stream!("data.csv") |> CSV.decode
Run Code Online (Sandbox Code Playgroud)
我试过像这样导入:
import(CSV)
File.stream!("data.csv") |> CSV.decode
Run Code Online (Sandbox Code Playgroud)
我试过为deps目录加上前缀:
import(deps.CSV)
File.stream!("data.csv") |> CSV.decode
Run Code Online (Sandbox Code Playgroud)
以及deps子目录的完整路径:
import(deps.csv.lib.csv.CSV)
File.stream!("data.csv") |> CSV.decode
Run Code Online (Sandbox Code Playgroud)
无论似乎没有找到依赖模块。
我想念什么?
每次访问https://team_abc.dev.myapp.me/时都会出现以下错误
This issue might be specific for subdomains. Not very sure in what other contexts this issue arrises.
07:26:06.498 [error] Could not check origin for Phoenix.Socket transport.
This happens when you are attempting a socket connection to
a different host than the one configured in your config/
files. For example, in development the host is configured
to "localhost" but you may be trying to access it from
"127.0.0.1". To fix this issue, you may either:
1. update [url: …Run Code Online (Sandbox Code Playgroud) 模板的渲染效果很好:
html = Phoenix.View.render_to_string(MyApp.BillingView, "receipt.html", %{organization: organization, transaction: transaction})
Run Code Online (Sandbox Code Playgroud)
...但我想用布局渲染这个视图。我怎样才能实现这个目标?
elixir ×9
postgresql ×2
azure ×1
cowboy ×1
ecto ×1
elixir-mix ×1
erlang ×1
maven ×1
repo ×1
subdomain ×1