When you are programming in most cases you need to have privacy with some variables, be it the database variables such as user, password, host etc. These are variables that have sensitive data that you usually need to store in an .env, example:


How do I get these values?

Easily, There is a third-party module that makes life much easier for us, such as: https://pypi.org/project/python-decouple/

pip install python-decouple

All it need is install and uses

from decouple import config

How do I use it?

Once you have imported, just call config function like this:

Thank you!!!!!.



This time I’m going to upload the images locally

First of all, it need a library call FastAPI

pip install fastapi

then what I do is create an ‘app’ object with which I will later create my routes.

app = FastAPI()

Finally we create our route called ‘/ files’ in which we accept bytes (the bytes of the images) and then what I do is create an image with those bytes received locally and I send a response with the message ‘got it’ to users.



Do you want to learn how to overwrite the user model in django?

Welcome to the best play to learn it.

We need to do this before executing any command that affects our database because if we do it later it will place an error.

First step, create a new app with a common command: django-admin startproject user then add two lines on your settings.py.

# Application definition
#New app


AUTH_USER_MODEL = 'user.MyUser'

MyUser is going to be your new user class.

That’s how you overwrite.

Thank you!!!.



How i can do this?

Well, just need a function call exec, this is native from python.

Basically, just need to read the file that you want to execute with (with open). first, look for your route then for a file name and once you got it call that function.

That simple is to run another script using a python script.

Thank you!!!!.



First of all, you need to know. What is poetry?
Poetry is a tool for dependency management and packaging in Python. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you, as they say in their page. https://python-poetry.org/docs/

How can I generate a requirements.txt from poetry.lock?
Well, you just need to write an easy command on your CLI (command-line interface).

► poetry export -f requirements.txt: this is the format to export

► — without-hashes: exclude hashes from the exported file

► requirements.txt: explain to the console where it is going to be.

That’s it, now you will have your requirements.txt generated.