Hello!
I buy Metronic to use with Django, but I find that I can't run python manage.py collectstatic to hash (cache busting) the static files. This is very important in production to full cache static files and have a hash in their names, so the cache is invalidated automatic when the files change (new hast will be calculated).
The way you make Django template is fixing the assets dir in the root of the project and config the same dir as static assets in production. So, I can't run collectstatic to apply the hashs and cache busting because django error indicate the sorce dir is the same output dir for assets.
See https://docs.djangoproject.com/en/4.1/ref/contrib/staticfiles/#manifeststaticfilesstorage
Can I move the assets inside _keenthemes and change the configuration to allow collectstatic works without break your template?
att,
Elieser
I faced the same error. but I could mange to solve it. you can take a look at my settings.py below:
STATIC_URL = "staticfiles/"
STATICFILES_DIRS = [
BASE_DIR / "assets",
]
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
don't forget to add this to the urls.py file of the project too
urlpatterns += staticfiles_urlpatterns()
Hi, I'm facing the same problem, I setted up my settings.py as you suggest and added the urlpatterns as you, but it still doesn't work.
I'm deploying in apache2 (Debian 12) with mod_wsgi.
What else can I do??
Thank you for sharing your feedback with us. We appreciate your honesty and understanding regarding the Metronic Django version. We're sorry to hear that it didn't meet your expectations.
If are experiencing dissatisfaction, you can request a refund through the Envato Market platform.
https://themeforest.net/refund_requests/new.
We will use your feedback to continue improving our offerings and ensure that our templates and resources better serve our users in the future. If you have any more suggestions or if there's anything else we can assist you with in the future, please don't hesitate to reach out. Your satisfaction is important to us.
Thanks
Hello!
I gave up using the Django version because it is not ready for production. I decided to create a Django version based on the HTML template myself. Thanks.
Hi Elieser,
Have you tried rebuilding the assets using Gulp from the _keenthemes/tools directory? You can find more detailed information in the documentation.
https://preview.keenthemes.com/django/metronic/docs/getting-started
Thanks
Hello!
I try your code, but strong personalization of django gives me another error:
FileNotFoundError at /
[Errno 2] No such file or directory: './assets/media/icons/duotune/arrows/arr061.svg'
In template C:\Users\elies\Downloads\django_demo1\starterkit\_templates\partials\modals\create-campaign\_main.html, error at line 14
Hi,
One thing you can try is to move the assets folder inside the _keenthemes folder and change the STATICFILES_DIRS setting in your settings.py file to point to the new location. For example:
# in your settings.py file
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "_keenthemes/assets"),
]
# in your settings.py file
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")