In production, I want to use nginx for serving statics. How to set a URL for assets in Play framework that we can use in both development and production. I like the way Django set STATIC_URL
in settings.
EDIT:
In Django, you can set STATIC_URL = 'https://static.domain.com/'
in settings.py
. In templates, you can call the value for:
<script src='{{ STATIC_URL }}js/jquery.js'></script>
You can add anything you need to the application.conf, so for an instance it can be the static domain (other than current app's domain), next you can ie. write simple getter in your controller (Java version):
application.conf
controller Application.java
view:
By the way...
If you just need to use absolute url pointing to the current domain, you can do it directly in the view using
Assets.at
function withabsoluteURL()
ie: