I wrote a filter for Django Compressor that removes unused CSS classes and makes your СSS files much smaller
I really enjoy simple, lightweight, and fast websites so I always try to keep my CSS and JS files as small as possible. I also like using Bootstrap for my projects since it helps to build a prototype to test the idea without much effort. However, Bootstrap and Tailwind CSS files are pretty large which directly influences the loading and render time of a website. To solve the problem, I wrote a filter for the amazing app Django Compressor that uses the PurgeCSS tool to remove unused CSS classes from your files and reduce the size of your CSS files size several times.
The filter automatically discovers all your Django templates, finds which classes are not used, and removes them. Thanks to the Django Compressor, it happens on the fly, so you don't need to manually run the PurgeCSS tool and copy/paste optimized styles every time you changed your styles. Moreover, Django Compressor allows you to use the filter alongside other filters, so you can also compile your SCSS files, compress CSS files, etc.
So far I tested it on one of my websites and it reduced my CSS files from \~200 Kb to 60 Kb (I use almost all Bootstrap components
/r/django
https://redd.it/xys6y4
I really enjoy simple, lightweight, and fast websites so I always try to keep my CSS and JS files as small as possible. I also like using Bootstrap for my projects since it helps to build a prototype to test the idea without much effort. However, Bootstrap and Tailwind CSS files are pretty large which directly influences the loading and render time of a website. To solve the problem, I wrote a filter for the amazing app Django Compressor that uses the PurgeCSS tool to remove unused CSS classes from your files and reduce the size of your CSS files size several times.
The filter automatically discovers all your Django templates, finds which classes are not used, and removes them. Thanks to the Django Compressor, it happens on the fly, so you don't need to manually run the PurgeCSS tool and copy/paste optimized styles every time you changed your styles. Moreover, Django Compressor allows you to use the filter alongside other filters, so you can also compile your SCSS files, compress CSS files, etc.
So far I tested it on one of my websites and it reduced my CSS files from \~200 Kb to 60 Kb (I use almost all Bootstrap components
/r/django
https://redd.it/xys6y4
reddit
I wrote a filter for Django Compressor that removes unused CSS...
I really enjoy simple, lightweight, and fast websites so I always try to keep my CSS and JS files as small as possible. I also like using...
If you're a beginner interested in data science and machine learning, I recently produced a video series that goes through all of the major algorithms and their implementations in Python! I put a lot of work into each tutorial, so hopefully this helps out!
https://youtube.com/playlist?list=PLvICEeb-TZEHKkojcv1_POKPrCwlsEnsI
/r/Python
https://redd.it/xyyj9t
https://youtube.com/playlist?list=PLvICEeb-TZEHKkojcv1_POKPrCwlsEnsI
/r/Python
https://redd.it/xyyj9t
CadQuery: Programming 3D objects in Python
https://california18.com/cadquery-programming-3d-objects-in-python/7251792022/
/r/IPython
https://redd.it/xz1fms
https://california18.com/cadquery-programming-3d-objects-in-python/7251792022/
/r/IPython
https://redd.it/xz1fms
California18
CadQuery: Programming 3D objects in Python - California18
Many already know and use OpenSCAD, but its limitations and the non-standard programming language are not for everyone. CadQuery uses Python and offers
Compatibility between Colab ipynb and local Jupyter notebook?
I've been using Google's Colab environment for a coursework - and my understanding is it's a mostly reskinned version of Jupyter notebook.
Can I assume ipynb notebooks exported from Colab to be compatible with my machine's local Jupyter installation? Are there known pitfalls or incompatibilities I should be aware of?
​
Thank you!
/r/IPython
https://redd.it/xyn9k5
I've been using Google's Colab environment for a coursework - and my understanding is it's a mostly reskinned version of Jupyter notebook.
Can I assume ipynb notebooks exported from Colab to be compatible with my machine's local Jupyter installation? Are there known pitfalls or incompatibilities I should be aware of?
​
Thank you!
/r/IPython
https://redd.it/xyn9k5
reddit
Compatibility between Colab ipynb and local Jupyter notebook?
I've been using Google's Colab environment for a coursework - and my understanding is it's a mostly reskinned version of Jupyter notebook. Can...
Can you rate my project, and tell am I ready for internship or junior position?
Here is my django project, I didn't know what to do and just create some social network app.
Please just tell me what did i do wrong and what should i learn
/r/django
https://redd.it/xzhtei
Here is my django project, I didn't know what to do and just create some social network app.
Please just tell me what did i do wrong and what should i learn
/r/django
https://redd.it/xzhtei
GitHub
GitHub - zhumagulovt/social: Backend for social network app or website
Backend for social network app or website. Contribute to zhumagulovt/social development by creating an account on GitHub.
I’m getting this import error when trying to open Jupyter. When I closed it, some files were still running so I’m not sure if that affected this. Can anyone help?
/r/JupyterNotebooks
https://redd.it/xz80nz
/r/JupyterNotebooks
https://redd.it/xz80nz
How to deploy django-tenants to production
I'm building a startup SaaS software and I decided to use django-tenants for my database wherein users can have their own schema and access din via schena domain. I tried to deploy it to heroku and railway.app. i also have hosted database from railway.app.
But I'm having some troubles using the domain schema. How to fix this?
/r/django
https://redd.it/xzsb47
I'm building a startup SaaS software and I decided to use django-tenants for my database wherein users can have their own schema and access din via schena domain. I tried to deploy it to heroku and railway.app. i also have hosted database from railway.app.
But I'm having some troubles using the domain schema. How to fix this?
/r/django
https://redd.it/xzsb47
reddit
How to deploy django-tenants to production
I'm building a startup SaaS software and I decided to use django-tenants for my database wherein users can have their own schema and access din...
Monday Daily Thread: Project ideas!
Comment any project ideas beginner or advanced in this thread for others to give a try! If you complete one make sure to reply to the comment with how you found it and attach some source code! If you're looking for project ideas, you might be interested in checking out Al Sweigart's, "The Big Book of Small Python Projects" which provides a list of projects and the code to make them work.
/r/Python
https://redd.it/y0069z
Comment any project ideas beginner or advanced in this thread for others to give a try! If you complete one make sure to reply to the comment with how you found it and attach some source code! If you're looking for project ideas, you might be interested in checking out Al Sweigart's, "The Big Book of Small Python Projects" which provides a list of projects and the code to make them work.
/r/Python
https://redd.it/y0069z
reddit
Monday Daily Thread: Project ideas!
Comment any project ideas beginner or advanced in this thread for others to give a try! If you complete one make sure to reply to the comment with...
D Simple Questions Thread
Please post your questions here instead of creating a new thread. Encourage others who create new posts for questions to post here instead!
Thread will stay alive until next one so keep posting after the date in the title.
Thanks to everyone for answering questions in the previous thread!
/r/MachineLearning
https://redd.it/xznpoh
Please post your questions here instead of creating a new thread. Encourage others who create new posts for questions to post here instead!
Thread will stay alive until next one so keep posting after the date in the title.
Thanks to everyone for answering questions in the previous thread!
/r/MachineLearning
https://redd.it/xznpoh
reddit
[D] Simple Questions Thread
Please post your questions here instead of creating a new thread. Encourage others who create new posts for questions to post here...
django-pghistory: Track historical events to Django models using Postgres triggers.
https://github.com/Opus10/django-pghistory
/r/django
https://redd.it/y04dzy
https://github.com/Opus10/django-pghistory
/r/django
https://redd.it/y04dzy
GitHub
GitHub - Opus10/django-pghistory: Track historical events to Django models using Postgres triggers.
Track historical events to Django models using Postgres triggers. - Opus10/django-pghistory
Analyzing cloud infrastructure metrics with Jupyter Notebook
We built a library that allows for the visualization and exploration of infrastructure metrics, collected via a cloud asset inventory.
https://resoto.com/blog/2022/05/31/resoto-meets-jupyter-notebook
It's hard to understand what's going on in your infrastructure if you're dealing with 100s of Ks of resources.
This notebook is a flexible way to track and analyze trends in the state of your entire infrastructure, and then drill down into indvidiual problematic resources.
For example, the heatmap in the image depicts the number of instances per core, per account.
The y-axis represents the number of cores per instance, while account IDs are listed along x-axis. The color of the heatmap cell indicates the number of instances with the given number of cores; the brighter the color, the greater the number.
Now you can yell at the developers that spin up expensive resources.
/r/JupyterNotebooks
https://redd.it/w9bhi3
We built a library that allows for the visualization and exploration of infrastructure metrics, collected via a cloud asset inventory.
https://resoto.com/blog/2022/05/31/resoto-meets-jupyter-notebook
It's hard to understand what's going on in your infrastructure if you're dealing with 100s of Ks of resources.
This notebook is a flexible way to track and analyze trends in the state of your entire infrastructure, and then drill down into indvidiual problematic resources.
For example, the heatmap in the image depicts the number of instances per core, per account.
The y-axis represents the number of cores per instance, while account IDs are listed along x-axis. The color of the heatmap cell indicates the number of instances with the given number of cores; the brighter the color, the greater the number.
Now you can yell at the developers that spin up expensive resources.
/r/JupyterNotebooks
https://redd.it/w9bhi3
Resoto
Resoto Meets Jupyter Notebook | Resoto by Some Engineering Inc.
We recently released Resoto Notebook, a library that allows for the visualization and exploration of the Resoto graph interactively using Jupyter Notebook.
is there any difference between using string.format() or an fstring?
Every time i see someone use format() instead of an fstring i get confused considering fstring has much more readability and is a lot more merciful on the programmer when there is more than 1 variable going into the string.
/r/Python
https://redd.it/xzsgz2
Every time i see someone use format() instead of an fstring i get confused considering fstring has much more readability and is a lot more merciful on the programmer when there is more than 1 variable going into the string.
/r/Python
https://redd.it/xzsgz2
reddit
is there any difference between using string.format() or an fstring?
Every time i see someone use format() instead of an fstring i get confused considering fstring has much more readability and is a lot more...
Django carpooling POC
Hi everyone!
I am a junior backend developer based in France, and I’m working on a carpooling side project using Django as a backend.
I’m trying to get users feedbacks and validate the interest of the market before developing a react native app served by my Django backend.
So it would be nice for me to get testeurs and feedback, or to meet front-end/ux designer available for a side project.
https://www.rute.fr
/r/django
https://redd.it/y08p9h
Hi everyone!
I am a junior backend developer based in France, and I’m working on a carpooling side project using Django as a backend.
I’m trying to get users feedbacks and validate the interest of the market before developing a react native app served by my Django backend.
So it would be nice for me to get testeurs and feedback, or to meet front-end/ux designer available for a side project.
https://www.rute.fr
/r/django
https://redd.it/y08p9h
www.rute.fr
Rute - Le service de covoiturage responsable
Rute est un service de covoiturage français éco-conçu et souverain qui reverse 50% de ses revenus pour financer des projets de mobilités dans votre région.
looking for an "low dependency" or pythonesque way to generate PDF's
I need to generate PDF's.
While
I want my tool to be deployable without the hastle to install non pythonesque tools. I want people to be able to install my package and use it after installing its
previously I've been using
So anyone has any hints?
I'd also be open to hints about deployment if this is not as big of an issue as I think .
As this is basically a webapp which people might run on their own PC's, I'm open to good firefox/chrome hints to print a styled page aswell.
/r/Python
https://redd.it/y0dxrg
I need to generate PDF's.
While
pdfkit looks very promising with its ability to render HTML with styling (Which would absolutely be the most epicness as almost no new templating would have to be made) it also depends on wkhtmltopdf and maybe even a virtual X server.I want my tool to be deployable without the hastle to install non pythonesque tools. I want people to be able to install my package and use it after installing its
requirements.txt.previously I've been using
FPDF but its also not so modern..So anyone has any hints?
I'd also be open to hints about deployment if this is not as big of an issue as I think .
As this is basically a webapp which people might run on their own PC's, I'm open to good firefox/chrome hints to print a styled page aswell.
/r/Python
https://redd.it/y0dxrg
reddit
looking for an "low dependency" or pythonesque way to generate PDF's
I need to generate PDF's. While `pdfkit` looks very promising with its ability to render HTML with styling (Which would absolutely be the most...
N Using machine learning to find an optimal mixture of metals to create a desired alloy
A large team of researchers at the Max-Planck-Institut für Eisenforschung GmbH, working with colleagues from Technische Universität Darmstadt, Delft University of Technology and KTH Royal Institute of Technology, has found that it is possible to use machine learning to help metallurgists find the optimal mixture of metals to create a desired alloy. In their paper published in the journal Science, the group describes their three-step process and how well it worked when tested. Qing-Miao Hu and Rui Yang with the Chinese Academy of Sciences, Institute of Metal Research, have published a Perspectives piece in the same journal issue outlining the work done by the team on this new effort.
Humans have been mixing metals to suit their needs for thousands of years, and in so doing have learned a lot about creating alloys. But finding just the right mix has always involved some degree of inspiration, patience and chance. So most alloys have been created by starting with one main metal, such as iron, and adding small amounts of other metals to see what characteristics resulted.
Over the past few decades, things have begun to change, however—some researchers have begun making alloys that have equal parts of several metals. Creating such
/r/MachineLearning
https://redd.it/y0ak52
A large team of researchers at the Max-Planck-Institut für Eisenforschung GmbH, working with colleagues from Technische Universität Darmstadt, Delft University of Technology and KTH Royal Institute of Technology, has found that it is possible to use machine learning to help metallurgists find the optimal mixture of metals to create a desired alloy. In their paper published in the journal Science, the group describes their three-step process and how well it worked when tested. Qing-Miao Hu and Rui Yang with the Chinese Academy of Sciences, Institute of Metal Research, have published a Perspectives piece in the same journal issue outlining the work done by the team on this new effort.
Humans have been mixing metals to suit their needs for thousands of years, and in so doing have learned a lot about creating alloys. But finding just the right mix has always involved some degree of inspiration, patience and chance. So most alloys have been created by starting with one main metal, such as iron, and adding small amounts of other metals to see what characteristics resulted.
Over the past few decades, things have begun to change, however—some researchers have begun making alloys that have equal parts of several metals. Creating such
/r/MachineLearning
https://redd.it/y0ak52
reddit
[N] Using machine learning to find an optimal mixture of metals to...
A large team of researchers at the Max-Planck-Institut für Eisenforschung GmbH, working with colleagues from Technische Universität Darmstadt,...
Analyzing cloud infrastructure metrics with Jupyter Notebook
We built a library that allows for the visualization and exploration of infrastructure metrics, collected via a cloud asset inventory.
https://resoto.com/blog/2022/05/31/resoto-meets-jupyter-notebook
It's hard to understand what's going on in your infrastructure if you're dealing with 100s of Ks of resources.
This notebook is a flexible way to track and analyze trends in the state of your entire infrastructure, and then drill down into indvidiual problematic resources.
For example, the heatmap in the image depicts the number of instances per core, per account.
The y-axis represents the number of cores per instance, while account IDs are listed along x-axis. The color of the heatmap cell indicates the number of instances with the given number of cores; the brighter the color, the greater the number.
Now you can yell at the developers that spin up expensive resources.
/r/JupyterNotebooks
https://redd.it/w9bhi3
We built a library that allows for the visualization and exploration of infrastructure metrics, collected via a cloud asset inventory.
https://resoto.com/blog/2022/05/31/resoto-meets-jupyter-notebook
It's hard to understand what's going on in your infrastructure if you're dealing with 100s of Ks of resources.
This notebook is a flexible way to track and analyze trends in the state of your entire infrastructure, and then drill down into indvidiual problematic resources.
For example, the heatmap in the image depicts the number of instances per core, per account.
The y-axis represents the number of cores per instance, while account IDs are listed along x-axis. The color of the heatmap cell indicates the number of instances with the given number of cores; the brighter the color, the greater the number.
Now you can yell at the developers that spin up expensive resources.
/r/JupyterNotebooks
https://redd.it/w9bhi3
Resoto
Resoto Meets Jupyter Notebook | Resoto by Some Engineering Inc.
We recently released Resoto Notebook, a library that allows for the visualization and exploration of the Resoto graph interactively using Jupyter Notebook.
Forbidden (CSRF cookie not set.): /login/ REACT & DJANGO
I have built the frontend with react and backend with django and everything works fine on localhost but when I deployed the frontend on heroku and made a POST request to login I got the following error:
Forbidden (CSRF cookie not set.): /login/
Front end code:
https://pastebin.com/CHArh4JL
backend code:
https://pastebin.com/sXv1AWhK
​
Here are my settings.py
https://pastebin.com/nqRVy6ty
/r/django
https://redd.it/y092w1
I have built the frontend with react and backend with django and everything works fine on localhost but when I deployed the frontend on heroku and made a POST request to login I got the following error:
Forbidden (CSRF cookie not set.): /login/
Front end code:
https://pastebin.com/CHArh4JL
backend code:
https://pastebin.com/sXv1AWhK
​
Here are my settings.py
https://pastebin.com/nqRVy6ty
/r/django
https://redd.it/y092w1
Pastebin
function getCsrf(){ fetch("http://localhost:8000/csrf/", { - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Applying theme to Django website
Hey fellow programmers,
I have just started my journey with Django. For the last month I've been trying to get the grip of this framework and create a project management website for my company.
I can do stuff on the backend confidently combining it with very basic html to make website functional. I'm currently at the point where I'd like to push further with the front-end side by adding an admin template from the internet. This is exactly where I'm struggling.
I can connect my main html file with the css, but I can't figure out how to wrap the theme around the functionalities I've made on the backend. I'm not sure where to paste the code inside the provided html code downloaded from the web.
Dennis Ivy seems to be covering this topic on his Django tutorial (just to give a brief idea on what I'm struggling with) I just can't produce similar results with a different template.
So I'm here to ask you for advice on how add a theme around django website. If you know a detailed tutorial explaining this process, or could provide some guidelines, or a link to a
/r/djangolearning
https://redd.it/y0exfi
Hey fellow programmers,
I have just started my journey with Django. For the last month I've been trying to get the grip of this framework and create a project management website for my company.
I can do stuff on the backend confidently combining it with very basic html to make website functional. I'm currently at the point where I'd like to push further with the front-end side by adding an admin template from the internet. This is exactly where I'm struggling.
I can connect my main html file with the css, but I can't figure out how to wrap the theme around the functionalities I've made on the backend. I'm not sure where to paste the code inside the provided html code downloaded from the web.
Dennis Ivy seems to be covering this topic on his Django tutorial (just to give a brief idea on what I'm struggling with) I just can't produce similar results with a different template.
So I'm here to ask you for advice on how add a theme around django website. If you know a detailed tutorial explaining this process, or could provide some guidelines, or a link to a
/r/djangolearning
https://redd.it/y0exfi
YouTube
Python Django 7 Hour Course
Build a discord-like application with Python Django. Visit the finished application at https://studybuddev.herokuapp.com/
Get The Full Django Beginners Course:
https://dennisivy.teachable.com/p/django-beginners-course/?product_id=3222835&coupon_code=BRAD…
Get The Full Django Beginners Course:
https://dennisivy.teachable.com/p/django-beginners-course/?product_id=3222835&coupon_code=BRAD…
Linking to DetailView
Hello!
Thank you all in advance for assisting me. I am having a little issue with linking to a detailed view of a product.
I am building a property management system as a learning project. This is my first ever project I have built by myself and I am actually pretty excited and happy I have come this far. It may not look pretty but I am super excited.
Anyway, the issue I am having is that I have a project with 3 applications inside; home, property, and tenant. Home, just contains the home/about/contact pages, Property displays the properties that are available for rent. I got the property link to display a list of all the available properties, however I am now trying to setup a link on each listing so a potential renter can view a property in more detail. I am stuck on how to create the connection between to page that displays all the properties and the detailed view.
Here is my [models.py](https://models.py)
from distutils.command.upload import upload
from email.policy import default
from random import choices
from tabnanny import verbose
from tokenize import blank_re
/r/djangolearning
https://redd.it/y04er3
Hello!
Thank you all in advance for assisting me. I am having a little issue with linking to a detailed view of a product.
I am building a property management system as a learning project. This is my first ever project I have built by myself and I am actually pretty excited and happy I have come this far. It may not look pretty but I am super excited.
Anyway, the issue I am having is that I have a project with 3 applications inside; home, property, and tenant. Home, just contains the home/about/contact pages, Property displays the properties that are available for rent. I got the property link to display a list of all the available properties, however I am now trying to setup a link on each listing so a potential renter can view a property in more detail. I am stuck on how to create the connection between to page that displays all the properties and the detailed view.
Here is my [models.py](https://models.py)
from distutils.command.upload import upload
from email.policy import default
from random import choices
from tabnanny import verbose
from tokenize import blank_re
/r/djangolearning
https://redd.it/y04er3