-
-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
assistance understanding assets and es build in production #22
Comments
Hi, This is documented in the docker-flask-example/.env.example Line 15 in 93af9f4
For production mode, you'll want to make sure all 4 of these are set: export COMPOSE_PROFILES=postgres,redis,web,worker
export DOCKER_WEB_VOLUME=./public:/app/public
export FLASK_DEBUG=false
export NODE_ENV=production Technically the last 2 are the default values, so by not setting them in the Once you've done that then you can |
Hi Nick, thanks for the response. In production I was getting the debug toolbar until I changed
Maybe it was a cached build problem, I'm not sure |
Hmm you can always run |
is it normal to have the JS and CSS rebuild like that in the background - I assume that means it's rebuilding something and configuration is not right |
In my previous comment I mentioned setting
|
I have the following set as I'm not using celery or postgres at the moment |
In that case the JS and CSS won't get recompiled or run in the background. They are precompiled once at Docker image build time and then are served on each request by either gunicorn or nginx if you add that into that mix. |
could you help me understand the function for this variable Seems that we always want env variables? |
Yes, that stemmed from this issue: pallets/flask#3872 Docker Compose already makes environment variables available without needing the dotenv Python package. Without setting that env var then all |
Hi Nick thanks again for working with me on these items. I'm having the worst time getting my production configurations working properly and missing CSS / JS modules. If I wanted to install Preline and tailwind typography / forms - wouldn't I just follow the install docs provided for each? Seems the pipelines are not properly adding those packages and I'm having to include the CDN version inside my main template to get them working. You might be thinking... "this is basic" and that's because I don't understand nodes role and asset compiling when it comes to packaging - I'm hoping for some quick tips to point me in the right direction for configuration and understanding as it relates to using flask *(this project) as a base in the case of praline it's stating to include this in your template '<script src="./node_modules/preline/dist/preline.js"></script>' but I'm not seeing any reference to ./node_modules/ folder generated on web container |
another item - when trying to add tailwind/forms I've added this to my Dockerfile for the asset pipeline edit my tailwind.config.js
when I run
|
Hi, You don't need to add the |
does this behavior change from production vs development? |
Yes, that's also mentioned in the docs and blog posts linked in the readme file. In production assets will get digested and saved in a spot so you can reference them from a web server without needing to run the |
I'm so close to getting this all sorted out... I'm trying to install preline yarn is doing it's thing properly but it seems that flask needs the /node_module/preline/dist/*.js files in order to work. What is the proper way to make those files available inside the application container. Seems that docker is only coping the /app/public folder |
Here is what I was able to come up with (doesn't feel very gitops) in the Dockerfile for the app layer
From there my package.json includes now work
and it's comparable with my tailwind.config.js
hopefully it helps and I welcome feedback on how to make it more turnkey / automatic |
Hi, I never used that package. I'm not super well versed with esbuild but I wonder if there's anything you can do or configure to have it copy those files to a destination directory so you don't need to modify your Dockerfile. |
Hi Nick,
It's me again, I'm new to ES build / Flask and fancy node based frontend stuff...
I've got an app in production and I'm seeing my logs continuesly state that it's rebuilding CSS and JS
The text was updated successfully, but these errors were encountered: