![]() ![]() ![]() Now, we need to download Django and Django-Rest-Framework. Now we need to activate the virtual environment by firing this command venv\Scripts\activateĪfter the virtualenv is activated, you will see (venv) before the directory path in your terminal. This venv contains all the virtual environment files and folders. Now after this command gets successfully executed, you will see a folder named venv in your project directory. To create a virtual environment, fire this command below. First, come to a directory where you want to keep your project files and open the terminal there. Now let's set up the virtual environment in which we are going to work. It will install the virtual environment in your system. Note: If you don't have Virtual Environment installed, fire pip install virtualenv Virtual Environment should be installed via pip.Any code editor like VSCode, Sublime, Atom etc.Python should be installed in the system.Steps will be similar, commands might be a little different in some cases in other operating systems. But surely, all of the things can be done in Unix/Linux-based OSs as well. Throughout the article, I will share code examples keeping Windows OS in mind. Today we will be creating a Word Counter application in Django and Django Rest Framework to expose REST API endpoints with Token Authentication. Also, there are authentication and permission issues with the exposed API endpoints, which Django Rest Framework (DRF) takes care of automatically. We can build such things in Django totally from scratch but Django Rest Framework provides an excellent way of handling these things more easily. Now that is a major task for a backend developer to serialize or flatten the data coming from a model with complex relationships. REST APIs can be developed in almost all possible backend frameworks and languages.Ī typical response from a REST API endpoint is always in JSON format. By exposing the REST API endpoints in a web server, we give control of the database to the client applications. In a typical client-server model, REST API is a popular name among developers. It is the medium of exchanging data between two applications or endpoints. ![]() Over the years we have been using APIs for many purposes. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |