
Python is a programming language known for its simple and readable syntax. It’s an interpreter language, which means you can run your code directly without needing to compile it. Python is a versatile powerhouse used in web development, data analysis, AI, machine learning, automation, game development, and system programming. With its rich standard library, developers can focus on the core features they want to create. Plus, integrating modules written in other languages is a breeze, and with a huge user base, there are countless frameworks and libraries available. π
Nowadays, even regular companies offer Python training, similar to office skills training, making it a language many know and use. Its simple syntax makes it easy for non-developers to learn and use. However, beyond just dabbling in data preprocessing, itβs a powerful development language capable of serious tasks. πͺ
As you get comfortable with Python, a thought might cross your mind: Can I build web services with this? Absolutely! That’s where the unfamiliar term Django comes into play. π
Django is an open-source web framework written in Python. It bundles all the features needed for web services, allowing developers to craft websites and applications quickly and efficiently. It uses the MTV (Model-Template-View) architecture, which consists of the Model for handling data, the Template for what users see, and the View as the mediator between data and user interface. It’s similar to the MVC (Model-View-Controller) pattern. Django offers ORM (Object-Relational Mapping) for mapping database schemas to Python code and provides several built-in security features. By abstracting common web development patterns, Django lets developers focus on business logic. π
For those with experience or knowledge, this might seem obvious, but let’s briefly outline the order for setting up a server to provide web services. π§
First, install Python on your server. Python allows multiple versions to be installed simultaneously. For instance, on Ubuntu, you can have python3.6, python3.7, python3.8, etc., installed at the same time. Python also supports setting up virtual environments, which lets you create isolated Python environments. This way, each project can have its own Python version and package dependencies. π¦
A virtual environment stores a copy of the Python interpreter, the standard library, and other necessary files in an independent directory. When activated, the path used when executing Python points to this directory, allowing only the packages and interpreter version installed in that environment to be used. π
Returning to server setup, first install Python, then set up the desired version of a virtual environment (python3.7 -m venv [environment name]). After activating the virtual environment (source [environment name]/bin/activate), install the necessary files. If you want to provide web services, this is when you install Django. To exit the virtual environment, use the command deactivate. π₯οΈ
For those familiar, this might be second nature, but I hope this post helps beginners who may be confused about Python and Django. π€
Leave a Reply