- Operating systems for Python development
- Pick your code editor
- Choose Your Terminal
- Check Out These Great Development Tools
- Example - My Django Development Setup
To start a Django project, you just need a computer with an operating system, a text editor, and some knowledge about software development. But is it really convenient and efficient to program this way? In this article, I'll show you how to speed up your work and make it more comfortable - both for you and your colleagues.
Note 1: If you're a beginner developer and need more information about Django, read this article: What is Django and How to Get Started?
Note 2: A programming setup is subjective, and only you can decide what is the best option for you. At the end of this article, I share my personal configuration for programming to give you an example.
Operating systems for Python development
Python developers usually use one of these two operating systems:
Mac OS X
Apple’s operating systems are well-synchronized with their hardware. What’s notable here is the navigation. Users can quickly move over all windows using only gestures and keyboard. I often end up not even using the mouse. In my opinion, the mouse is not convenient and slows work down. The user interface is nice and powerful. Searching for functionalities is easy. Installation of new things is as easy as possible. The biggest cons of Mac OS X is cost and compatibility with other hardware than the dedicated one.
|User interface: Apple products are known for their intuitive user interfaces.
|Price: Typically pricier than many competitors.
|Navigation using gestures: Enhances user experience.
|Limited hardware choice: Restricted to Apple's ecosystem.
|Fewer viruses and security issues: Apple's closed ecosystem offers fewer security threats.
|Less customizability: Apple's systems are more locked down, offering fewer customization options than some competitors.
|Stable: Renowned for system stability.
|Repair and upgradability issues: Many Apple products could be more user-friendly for repairs or upgrades, often requiring specialized tools or expertise.
|Great integration between OS and hardware: Seamless integration due to Apple producing both.
|Software restrictions: The App Store has strict guidelines, which can limit the variety and type of apps available compared to open platforms.
TIP: Install a package manager called Homebrew. It will make the installation of different software solutions easier.
TIP: I really recommend Mac OS X, because you get to focus on programming and not configuring or solving different problems.
Linux is a great option for both beginner and advanced programmers. You can choose from a variety of distribution options that match your preferences and customize almost everything (but note that it often takes more time than on e.g. OS X). The design is nice too. The standard navigation is not sufficient, but you can configure it. The Linux community is really helpful and can help you solve any problem. Sometimes drivers for Linux may not be available, but in most cases it’s not an issue.
The most popular distributions are:
- Debian GNU/Linux,
- Arch Linux,
|Free to use.
|Less support for drivers: can sometimes make it challenging to use certain hardware.
|Open-source: Offers transparency and the ability to modify the source code.
|More complicated: might have a steeper learning curve for new users.
|Helpful community: Extensive forums, blogs, and online resources.
|Limited software availability: Not all commercial software is available for Linux.
|Security: Generally less prone to malware compared to some other operating systems.
|Inconsistent user experience: Due to the variety of distributions.
|Customization: High flexibility to customize the environment to user needs.
|Requires more hands-on maintenance: Users might need to manually handle updates and troubleshoot issues more frequently than with other operating systems.
|Variety of distributions: Provides options for different user needs and hardware.
|Privacy: Many distributions prioritize user privacy.
Unlike most Unix systems and services, Windows doesn’t include a system-supported installation of Python, but that doesn't mean that you can't program on Windows. The design is nice, you can customize most things and set them up as you like. It’s also cheaper than Mac OS X. At the beginning, you may have to install some things (for example, Python), but it takes just a few minutes.
|Nice user interface: Visually appealing and user-friendly.
|Price: It can be costlier compared to other alternatives.
|Easy and intuitive: Suitable for beginners and experienced users alike.
|More threats and viruses: May be a more common target for malicious software.
|Stable: Consistent performance with fewer crashes or issues.
|Some packages may need to be fixed: Occasional compatibility or stability issues with specific software.
|Community support: A helpful and active user base for troubleshooting and sharing experiences.
|Potential steep learning curve for some users: Especially those transitioning from other operating systems.
|Hardware support: Compatible with a wide range of devices and systems.
|It might require more frequent updates: This can be seen as a disruption for some users.
Pick your code editor
Selecting the right code editor is a crucial step in setting up your Django development environment. I've been using Visual Studio Code and highly recommend it. Here's why:
Customization: Visual Studio Code can be easily customized to fit your preferences. Its extensive customization options allow you to tailor the environment to your liking. You can truly make it your own.
Plugin Ecosystem: There's a plugin for nearly everything you can think of. Whether you need support for a specific programming language, version control integration, or tools to enhance your productivity, you will likely find a plugin that suits your needs.
Visual Studio Code is one of the two most popular code editors among developers. The other popular choice is PyCharm.
TIP: During the setup process, take the time to search for and install helpful plugins that can significantly boost your productivity. If you're a Python developer, it's particularly wise to select tools that offer features like syntax correctness checking.
Great text editors for Python/Django developers
PyCharm: PyCharm is an integrated development environment (IDE) by JetBrains designed for Python. It offers features such as source code editing, code analysis, a graphical debugger, unit testing, and version control system integration. PyCharm supports the development of web applications in Django and comes in both paid and free versions, with various editions available.
Visual Studio Code: Visual Studio Code, created by Microsoft and distributed under the open-source MIT license, is a free code editor with syntax coloring for a wide range of languages. It stands out for its interesting features, refined graphical interface, lightweight design, and swift performance.
Sublime Text: Sublime Text is a cross-platform, highly configurable code editor written in C++ and Python. You can download and use it for free, but the free version occasionally prompts you to register or purchase the full, paid version.
Vim: Vim is a highly configurable code editor known for its efficiency. It is included as "vi" in most UNIX systems and Apple's macOS. Vim is renowned for its stability and ongoing development to enhance efficiency further.
Choose Your Terminal
When it comes to selecting a terminal for your development environment, you have several options. Sometimes, your code editor may come with a built-in terminal. Alternatively, you can install a terminal as a plugin to your editor, which is a convenient option.
Whether you should install another terminal or stick with the default one depends on your specific needs. Let's delve deeper into this matter by considering a few key factors.
Start by asking yourself these questions:
- Do you frequently test your code in a shell?
- Do you rely on the terminal for version control system integration, or do you use an external application?
If you answer yes to either of these questions, installing another terminal may make sense. It can greatly enhance your workflow and convenience.
However, if your use of the terminal is limited to running occasional commands, then sticking with the default terminal might be sufficient. For instance, if your tasks involve running projects and committing changes using a specialized program, additional terminal software may not be necessary.
TIP: Whether you decide to use a default terminal or opt for an alternative, I encourage you to enhance your terminal's functionality by installing tools like Oh My Zsh. Such enhancements can make your terminal experience more interactive and productive.
The Best Terminal Alternatives
Here are some excellent terminal options to consider based on your operating system:
iTerm2: This terminal is a go-to replacement for the macOS Terminal app. It supports features like split panes, making it a favorite among those who work on the command line.
Alacritty: Alacritty prioritizes simplicity and performance. Leveraging your graphics card, it provides blazing-fast scrolling through long screens.
Terminator: An open-source terminal emulator, built in Java, that inherits features from Gnome Terminal. It excels at multitasking, enabling you to split tasks into panes within a single window. Ideal for efficient workflow management.
Tilda: Tilda is similar to popular terminal emulators like Gnome Shell, Konsole, and xterm but has unique features. It can be pulled down and up from the top of the desktop screen, offering a different terminal experience.
Alacritty (Linux): Renowned for its simplicity and performance, Alacritty is a lightning-fast terminal with carefully chosen default features, coupled with the flexibility to configure various aspects as needed.
Check Out These Great Development Tools
Here are some must-have development tools to enhance your workflow:
pre-commit: A tool that helps you maintain clean and consistent code by automatically checking code formatting, style, and other criteria before each commit. It ensures that your codebase adheres to predefined standards and reduces the likelihood of integration issues.
Postman: An excellent tool for managing projects with APIs. Easily make queries to APIs, save them, and organize them in virtual folders. You can even share these folders with others.
GitHub Desktop: Streamlines GitHub workflows, making it fast and easy to contribute to projects.
On our blog, you will also find an article about a typical web development workflow - be sure to check it out!
Advanced REST Client (Chrome Plugin): Perfect for making custom requests to different web pages. A valuable tool for API testing.
Docker: Helps developers create, deploy, and run applications using containers, similar to virtual machines. Docker includes a "Compose" tool for defining and running multi-container applications.
DBeaver: A free, multi-platform database tool for developers, SQL programmers, database administrators, and analysts. It supports all popular databases.
IPython (Interactive Python): A versatile command shell for interactive computing in multiple programming languages. It offers introspection, rich media, tab completion, and history.
Refined GitHub (Chrome Plugin): Simplifies the GitHub interface and adds useful features.
Zsh (Z Shell): An interactive shell designed for interactive use and a powerful scripting language.
Oh My Zsh: An open-source, community-driven framework for managing your Zsh configuration.
HTTPie (Command-Line HTTP Client): Simplifies CLI interaction with web services, providing a user-friendly syntax for sending HTTP requests. It offers colorized output and is handy for testing, debugging, and interacting with HTTP servers.
Explore these tools to optimize your development experience and boost productivity.
Example - My Django Development Setup
I primarily work on macOS, which is convenient and intuitive. The OS X environment allows me to focus on development tasks without the need to search for solutions online constantly. It provides a smooth user experience comparable to Linux, all without the worry of unexpected issues.
For my Django development, I rely on Visual Studio Code with several essential plugins:
- Black Formatter
- SQL Formatter
- Flatland Monokai Theme
- GitHub Pull Request and Issues
- HashiCorp Terraform
- Prettify JSON
- Quick Control for VSCode
- CSV to Table
- String Manipulation
To enhance the terminal experience, I use iTerm2, which I find to be a more customizable replacement for the default terminal. I've also installed Oh My Zsh and IPython to make the terminal more interactive, aiding in code testing.
For API testing and URL collection, I rely on Postman. It's a valuable tool when I have preconfigured requests that need a little modification or quick testing. Postman also offers a built-in testing tool and maintains a history of requests.
Docker is another indispensable tool for me. It simplifies project deployment and configuration, enabling me to start a project with a single command. By defining services in a docker-compose.yml file and creating a custom Dockerfile, I can effortlessly manage my Django application's development environment.
RUN pip install --upgrade pip
ADD requirements.txt requirements.txt
RUN pip install -r requirements.txt
RUN mkdir /app
ADD /app/ /app/
CMD python manage.py runserver 0.0.0.0:8000
Don't forget to maintain a requirements.txt file to manage your dependencies:
You can create your project by running the following commands:
mkdir app- to create a directory to store the application code.
pip install Django- to install the Django package.
django-admin startproject mysite app- to generate a Django application.
docker compose build- to build the Docker image for your Django application using the Dockerfile.
docker-compose up- to start your application using the docker-compose.yml file.
Learn more about Docker here to improve your development practices.
Additionally, I recommend using a Makefile to streamline your development workflow further. A Makefile automates and manages the build process of your project. Here's an example:
docker compose build
docker compose up
docker compose down
docker attach django_app
docker exec -it django_app bash
docker exec -it django_app python manage.py shell
docker exec -it django_app python manage.py migrate
docker exec -it django_app python manage.py makemigrations
With this Makefile, you can use the following commands:
- make build
- make up
- make down
- make attach
- make bash
- make shell
- make migrate
- make migrations
These commands simplify and automate common tasks in your development process, saving you time and effort.
Setting up the ideal development environment maximizes productivity and ensures smooth project execution. Choosing the right operating system, code editor, and terminal is paramount.
Selecting tools that align with your preferences, workflow, and project requirements is essential. In addition, the vast array of development tools available, like Postman, GitHub Desktop, and Docker, can further augment your development process, making tasks like API testing or containerization more efficient. Remember, the key is to find a balance between familiarity and functionality. Regularly exploring new tools and configurations can offer fresh perspectives and might lead you to discover more efficient working methods. Whatever you choose, ensure it complements your unique development style and enhances your coding journey.
Are you looking to elevate your development experience? At Sunscrapers, we pride ourselves on utilizing the best tools and technologies to streamline our projects. As your trusted tech partner, we can guide you in enhancing your development setup and bringing your projects to life. Contact us today, and let’s build something great together!