Styling React Components

My goal was to find a maintainable and scalable way to style React components at iFixit. These were the features I was looking for in a React styling system: I chose to use glamorous, a React styling…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Python libraries you should be using along with Django

Designed by: Author

When it comes to backend development in Python, Django is one of the best frameworks you can find. It enables you to do fast development because of the number of features it has and its built-in ORM. Moreover, you can add new functionalities with the help of a wide variety of libraries specifically designed for Django. Here, we are going to discuss some of the important and popular ones.

Features:

Everything is working fine, but as soon as you put the API endpoint in your Javascript application and try to run it, it throws a CORS error.

Unfortunately, Django doesn’t have anything in-built for this. django-cors-headers library addresses this issue and is really easy to add to your Django app. Here’s how you can do this:

Install using pip

In your settings.py file, change the following configurations

Another good thing about this is it integrates well with the Django rest framework, which comes in pretty handy.

Here’s a glimpse of how to use filtersets. You can explore more in the official documentation.

So, you are done developing an app and everything is working well from your local machine. It’s time to deploy your application on the server(s).

In your settings.py file, you might have defined paths for static and media files such as the CSS and Javascript files, icons, and Images/files shown in the app.

You’ll want to store all those files in a location independent of the servers’ lifecycle, similar to a database so that you don’t lose this data if a server goes down. It also helps data consistency on your web application if you have multiple servers running in the backend.

django-storages comes to the rescue. It supports several cloud providers such as Amazon S3, Google Cloud Storage, and Azure Storage among others.

I hope this helped you in some way. If you made it through here, consider following for more bits like this.

Happy Coding… :)

Add a comment

Related posts:

Coffee house gives 2017 update

Stepping into the new Mary Low Coffee House takes one’s breath away. It is unlike any other building on campus and was initiated and run all by Colby students. The idea, creation, design, and…

Code as a Language

During the course of my learning of Python, I realised that “ hackers and painters are among the most alike”- Paul Graham. Artists and Coders are both makers indeed. While painting, an artist fills…

A New API for WCMA

It was a great summer at WCMA Digital. Summer means focused time to work on systems and infrastructure (yay!), without the delightful distraction of classes and students and faculty. It also means…