Using uv to Manage Django Projects
uv
is a tool from Astral.sh that helps you manage Python tools and development projects. For all the details you can
read the docs, but here's a quick lesson in what it can do and how it can help Python developers in the daily grind of developing Python software. We'll walk through managing a hypothetical Django project.
Installing and/or Running Python Tools
Django has a command for starting new projects: django-admin startproject myproject
.
But of course, you have this chicken and egg problem. In order to start a Django project, you must first have Django installed. uv
's tool
subcommand fixes this problem. uv tool run
(and its shortcut alias, uvx
) will create a temporary virtual environment, install the requested tool into it, and run it from there.
So to bootstrap my Django project with uv
I can:
uvx --from django django-admin startproject myproject
The --from
tells uv
which package to install. You can leave that out if the package and the command have the same name.
If you don't already have Python installed, uv
can install it for you:
uv python …
Users and Groups
Linux puts a lot of power at your fingertips. That's the best reason to switch to Linux; it's also the most dangerous thing about the system. Linux controls how much power you can use on the computer based on your Login ID. It keeps a database of all users, and it keeps track of which user owns which files, and which users have permission to view, edit, and execute each file, folder or program. An ordinary user will not be able to do really dangerous things, like editing the user database, or deleting every file on the system.
Understanding Linux user permissions is crucial for managing a secure and efficient system. This article will delve into the essentials of Linux user and group permissions, covering key concepts and configurations.
Identity and Permissions
In Linux, every file and process is owned by a user and a group. These ownerships determine who can access or modify files and execute commands. The system uses three types of permissions:
- Read (r): Permission to read the file or list directory contents.
- Write (w): Permission to modify the file or directory.
- Execute (x): Permission to execute …
Managing Linux Software with APT and dpkg
Managing software on a Linux system can seem daunting to newcomers, but tools like apt
and dpkg
make it straightforward and efficient. This tutorial will guide you through the basics of using apt
and dpkg
to manage software on Debian-based distributions like Ubuntu.
What are apt
and dpkg
?
-
apt
(Advanced Package Tool): A high-level package management system that simplifies the process of installing, updating, and removing software packages. It automatically handles dependencies, ensuring all required software is installed. -
dpkg
(Debian Package): A low-level package manager for Debian-based systems. It handles the installation, configuration, and removal of.deb
packages but does not resolve dependencies on its own.
Let's explore common tasks using apt
and dpkg
.
Installing a Package with apt
To install a package with apt
, use the install
command. For example, to install the text editor vim
:
sudo apt update sudo apt install vim
sudo apt update
refreshes the list of available packages and their versions.sudo apt install vim
installs thevim
package.
Uninstalling a Package with apt
To remove a …
Django Settings: Three Things Conflated
If you work on a large Django project, there's a good chance that you would describe your settings file as "a mess" (or perhaps you use harsher language). You may even have broken your settings out into a whole package with multiple files to try and keep things organized. We're highly skilled and organized developers, how does this happen to us?
I believe part of the problem is that the "settings" bucket holds three different kinds of things without differentiating between them. If you make a clear distinction between these things in your own mind (and in your code), dealing with settings will become easier, if not easy.
Project composition
The first class of settings comprises those used for project composition. One of the killer features of Django is that projects are composed of independent modules (apps). The most important settings in your project's settings file define what apps make up the project and how they interact with each other. In other frameworks this would be done with code (well, technically settings are Python code), but in Django this is treated as configuration. Things like INSTALLED_APPS, MIDDLEWARE_CLASSES, and TEMPLATE_CONTEXT_PROCESSORS define how the components of your …
Linux Training and Certification
:::: caution ::: title Caution :::
Sorry, I haven't had a chance to update this page in a while. I removed some dead links. Hopefully the information that remains is still useful. ::::
Linux is an operating system ideal for self-study, since the source code and documentation are freely available. Sites like Control-Escape and the Linux Documentation Project are here to help new users learn for their own interests and at their own pace. However, many people find that they learn better in a more structured environment, prefer a guided study (perhaps because they don't have time to explore free-form), or want to further their career goals in addition to gaining some knowledge. Here is a collection of resources that can get you "officially" educated and even certified on Linux.
As Linux continues to invade corporate IT departments, certification will become more and more important when looking for a job in the field. Most of the resources on this page lean toward preparing for certification, but will also be useful for those who merely wish to expand their own knowledge but prefer media other than the web.
Certification and Training from Linux Vendors
If you …
What is Linux?
Linux is Free/Libre Open Source Software. You can download a free copy of Linux and install it on your own computer. No password is required for access, and no registration is required after downloading. There are no "nag" screens begging you to pay for it. It is not crippled in any way, nor is it limited to any particular kind of use. You can use it at home, at school, in your business. You can install it as many times on as many computers as you like, and you can legally make copies of it and give them to friends and colleagues (or even sell copies if you wish).
Linux powers the servers that deliver Google search results to you (and most other web sites, actually). It is also the core of the Android system that powers the latest smart phones and tablets. Linux is capable of powering giant servers, standard desktop computers, handheld devices, and tiny embedded systems.
Linux Distributions
Technically, Linux is an operating system kernel, the core part of an operating system. (See What is an operating system? if you are not clear on this point.) The Linux kernel is commonly bundled with …
Introducing The X Window System
WARNING: This article is out of date. It is retained for historical purposes only.
The X Window System is the graphical interface for Linux (and I think every other variant of UNIX, too). A word of caution for users of MS Windows: unless you are looking for fight, don't ever call it "X Windows" around a UNIX person! Flame wars have raged for years over this. The proper term is "The X Window System." If you must shorten it, call it X11, or just X. They'll know what you mean. I will be using these terms interchangeably below.
Like everything else on Linux, the X Window System is based on a network paradigm. The program that actually controls your display, drawing the boxes and buttons you see, is called the X Server. Each X server is made for a specific video card, so there are several X servers to choose from. Programs that use the X server to display themselves on your screen are called X clients. Unlike MS Windows, the X server and X client can run on different computers and talk to each other across the network. This means that you can run a …
Introducing WordPerfect 8 for Linux
Note: Corel no longer makes Wordperfect for Linux. This article is out of date and is maintained for historical reference only.
Obtaining WordPerfect
WordPerfect can be downloaded from the Internet without charge or purchased on CD-ROM from several Internet vendors. See Resources below for a list of sources. The downloaded version must be registered at Corel's Linux Site to be functional after 30 days, but there is no charge for registration.
There are two ways to download WordPerfect, either as one big file (about 25MB) or as several pieces. If you chose the one big file method, you should end up with a file called GUILG00.GZ. This is the first problem you will run into (okay, the second, the first is completing a 25mb download!). The file should have been called guilg00.tar.gz, because it is tarred and then gzipped and Linux is case sensitive with the default being lower case. If you use the Linux version of Netscape to download it, the file naming scheme will be further aggravated by Netscape, which tries to be helpful by unzipping *.gz files when it downloads them, but neglects to remove the .gz file extension. So when the download is …
A Little About The X Window System
:::: warning ::: title Warning :::
Information on this page has not been updated in a long time. It may be out of date. ::::
Among other things, X provides programs with standard services to display themselves graphically. The concept of running graphical programs in a window should be familiar to everyone reading this. However, when you're in X, things will look a little strange. Your screen may look a lot like MS Windows, or nothing at all like it. Why?
Window Managers
X11 gives programs the ability to show themselves in a window. However, what that window looks like, where it appears on the screen, how you call it up, etc., are controlled by a separate program called the Window Manager. Its title more or less describes its function. In Windows 95, this job is filled by Explorer, in Windows 98 by Internet Explorer, and in Windows 3.x (if you can remember back that far) it was Program Manager. I've never used a Mac, but readers tell me this job is filled by Finder on that platform. The thing is, each of these environments provide you with ONE window manager. Although you may be able …
Networking Windows & Linux
Linux is able to access directories, files, and printers that are shared from MS Windows machines, and can act as a server for Windows clients, thanks to a software package called SaMBa. The latest version of SaMBa also allows Linux computers to participate in Windows NT domain-based networks.
SaMBa is an implementation of the SMB protocol, also called the NetBIOS or LanManager protocol. This is a networking protocol used by Windows. It ships with most of the major Linux distributions, and is available for many different operating systems.
Getting SaMBa running was quite easy for me with the help of the SMB HOW-TO, and should be equally easy for most folks, so I won't go into too much detail. The steps are these:
-
Get your Ethernet configured. (A whole separate FAQ!)
-
Set up TCP/IP on each of your machines. By default MS uses their NetBEUI protocol, which Linux doesn't understand (yet). You need to install the TCP/IP protocol for Windows (comes on the Windows CD). This is done under Network Properties in the control panel. (See Windows help for details, but I found it self explanatory.) Each machine must have an …
Linux Installation, Step by Step
If you have come directly to this page hoping to install Linux without doing any more reading, I suggest that you reconsider. Without the proper knowledge and preparation, attempting to install any operating system (whether Linux or any other) can be a disaster. So before I launch into the resources for your step by step Linux installation, here are some things you should already have read:
Each Linux installation has its own setup utility, every one vastly different from all the others. This makes it very difficult if not impossible to write a step by step Linux installation manual. The closest thing in existence is the Linux Installation and Getting Started Guide, which should be included in HTML format with every Linux distribution, and is available online thanks to the Linux Documentation Project. This book contains a fairly good comparison of the major distributions and an outline of the installation process for each one. It also covers the basic technical concepts you need to understand during installation, and covers some issues of usability following your install. I highly recommend that new users at least skim through this book, and preferably absorb every word.
Also well worth …
Configuring LILO, the Linux Loader
What is LILO?
LILO is the LInux LOader, the most popular boot loader for Linux. (For some background on boot loaders, see Choosing a Boot Loader) It is used to load Linux into memory and start the operating system. On a machine with multiple operating systems, LILO can be configured to boot the other systems as well.
Normally LILO is initially configured for you during the Linux installation process. However, you may find that default configuration is not correct, or you wish to customize it. And there may even come a time when you need to remove LILO from your computer. Here are some instructions that should help you on your quest.
The /etc/lilo.conf File
As with many Linux utilities, LILO can be customized with a configuration file in the
/etc
directory. The lilo.conf
file has its own man page which is quite thorough. In fact, it may be a little too thorough for simple configuration. So here's the lowdown on your basic lilo.conf file.
The sample lilo.conf file shown below is for a typical dual-boot configuration, with Windows installed on the first partition and Linux on the second. You can probably use this …
Choosing a Boot Loader
Every operating system provides a tiny program called a boot loader whose job is to load the rest of the operating system into your computer's memory at boot time. It is typical of the Linux personality that it gives you a choice of boot loaders.
If you will be running Linux on a computer by itself, there is no need to read any further, you want to use LILO as your boot loader. You can skip ahead to the section about LILO. If you are planning for Linux to share your computer with Windows, DOS, or another operating system, your choice will involve a little more discrimination.
When setting up a multiple boot PC with Linux, you have three choices about how to get it loaded: LILO, Loadlin, or floppy. Let's examine each separately.
LILO, the Linux Loader
Although opinions vary, LILO is certainly the most popular boot loader for Linux. It resides on your hard drive, and at boot time it presents you with a "boot prompt" where you can choose an operating system to boot, choose a particular Linux kernel to load, and pass special parameters to the Linux kernel when it is loaded. …
Partitions: Planning Your Linux Installation
This article will explain some of the terms involved with partitioning your hard drive, as well as some concepts you will need to understand before installing Linux, and will help you determine what partitions you need to create for Linux.
What is a partition?
Imagine your company is moving into a new building that is set up like a warehouse. There are no internal walls, it's just one big room for everybody to work in. Chances are, the first thing the boss is going to do is build himself an office (he wouldn't want to associate with you workers), so he'll have a partition set up, an internal wall to separate him from you. Next, each worker will get a cubicle in the big room with smaller partitions to separate you from the person next to you.
Hard drives work the same way. The disk gets partitioned into smaller, separate pieces which can belong to different owners. In our case, Windows might own some and Linux will own others. On hard drives though, the word "partition" does not refer to the wall itself, it refers to the separated space. So we say Linux is installed "on" the …
What is an Operating System?
Note: For the sake of clarity, many of these concepts have been over-simplified.
An operating system is a group of programs that help you operate your computer. It could be considered the "government" of your computer's internal society, the central program that tells the other programs what they may do and provides services they need. A computer might contain more than one operating system, but only one operating system at a time may be "in charge". The action of starting or loading the operating system is called "booting" the computer.
Windows 7 is one popular example of an operating system (though perhaps not the best example!). MS-DOS is (or was) also an operating system. Linux is an operating system as well. All of these systems perform similar tasks, and only one at a time can be in use. (Unless you have some special tools. We'll talk about those elsewhere.)
An operating system normally consists of some basic parts. A kernel
, a core program that controls the most essential hardware (the processor and memory, for example); some
device drivers
that control other system hardware (network cards, sound cards); and a
shell
, a program that communicates with …
What is Free/Libre, Open Source Software?
In the simplest terms, open source software is software you can share. But it is more than just shareware. Open source means that the source code
of the software is available to the users. To understand what this means, we'll need to take a little detour into how computer programs actually get made.
How Computer Programs Are Made
A computer program is a list of instructions given to a computer to make it perform a specific task or series of tasks. Computers do not understand English (we all wish that they did!), so programmers must communicate these instructions to the computer in a language the computer understands. Computers, however, can only operate on numbers, which makes a computer's language very difficult for humans to understand.
The solution to this problem is to create an intermediate language that both humans and computers can understand. These are called programming languages
. Programmers create a list of instructions for the computer in a programming language such as C, Pascal, or Fortran. This list of instructions is known as source code
. It is textual in nature, and readable to humans (the ones who speak the language). Programmers do …
Installing Software on Linux
One of the most difficult things to get used to in the Linux world is installing new software packages. In the world of Windows, every program comes with a Setup.exe
program that asks you some very easy questions and takes care of the job for you. While Linux software can be almost that easy to install, you will sometimes find software that seems to fight every step of the way. I can't cover all the problems you might run into, but I'll try to give you the basics and a few pointers to help get you over the rough spots.
Software tends to come in "packages". In the Windows world a package is a Setup.exe
or a program.zip
file. On a Mac a package is a program.dmg
or a program.sit
file. In the Linux world, there are several kinds of packages, and each distribution has its own preferred package format.
The standard Linux package format (according to the
Linux Standard Base) is RPM
. RPM is a packaging system originally developed by Red Hat and widely used in the Linux community. Distributions using it include Fedora, Mandriva, Red Hat (naturally), and SUSE. An RPM package file normally …
Managing Software with urpm
Mandriva's urpm
('User RPM') tackles several weaknesses of the lower-level rpm
tool. It provides a system of automatically solving dependencies by offering to install or uninstall dependent packages. RPM only tells you which files are missing or which packages would be broken. It stores a full dependency set of any given location. RPM only stores data of locally installed packages. If configured, it fetches packages from the network upon installation, if they are newer than the packages on the installation media. It also allows easier and more extensive package queries, automated updates and more.
urpm
isn't meant as a replacement for RPM, it is meant to make common RPM tasks easier. In many ways it resembles the package tool the of the Debian GNU/Linux distribution, APT.
Configuring urpm
The central configuration file is /etc/urpmi/urpmi.cfg
, the flat text data files are located in /var/lib/urpmi
, the log files in /var/log
.
You can put certain packages on 'hold' to prevent them being updated by adding the package names to the file /etc/urpmi/skip.list
, one name per line. For example, you might want to prevent installing newer kernel
or glibc
packages by adding those names to …
Adding File Systems to the Tree
To gain access to files on another device, you must first tell Linux where in the directory tree you would like those files to appear. This process is called mounting a file system. For example, you will frequently need to access files from CD-ROM. In order to do this, you must tell Linux, "Take the file system from this CD-ROM and make it appear under the directory /mnt." The directory given to Linux is called the mount point. In this case it is /mnt. The /mnt directory exists on all Linux systems, and it is intended specifically for use as a mount point for temporary media like floppy disks or CDROMs. It may be empty, or it may contain subdirectories for mounting individual devices.
Linux does not require you to use /mnt as the mount point for other file systems. You may mount file systems anywhere in the directory tree. However, it is good practice to create empty directories that are reserved as mount points. Linux will allow you to mount a file system on a directory that is not empty. Any files in that directory will become invisible in the virtual file system. They will still exist on …
The Linux (Virtual) File System
Probably the most important difference (from the user's perspective) between the DOS/Windows world and the Linux world is the organization and operation of the file system.
Some ideas will seem very familiar, and others will seem completely alien, but with a good understanding of the Linux file system, you have the skill to avoid some of the most common problems experienced by new Linux users.
What is a file system?
Ever go looking for a book in the library? In order to find what you're looking for, you must understand the library's file system, or method of organization. Fiction books are easy, they use a simple type of file system commonly known as alphabetical by author. Nonfiction books can be tougher because they use a different type of file system, the Dewey Decimal System. What if you don't understand the Dewey Decimal System? What if you only know the title of a book and you don't know whether it's fiction or non-fiction? How can we find our book now? Luckily there is a librarian to help us, and she has created a card catalog (or in most libraries now, a computerized catalog) listing all the books available …
Editing Files with Emacs
If you're going to use Linux, there simply is no avoiding emacs. You've probably heard of it, the powerful text editor that provokes wars between its devoted fans and fans of its more ancient but still omnipresent competitor vi. To those of us migrating to Linux from a more graphically oriented environment, both programs seem alien. You might think you can escape by using some other program, but you can't escape because every program you pick up tries to imitate emacs in some way.
Getting to know emacs may be a necessity, but it's no picnic for immigrants from other operating systems. We know that emacs is "powerful", and we would like to access all that power, but it's so hard just to get started editing a file! As a beginner, I started up emacs thinking it would be like any word processor. Fifteen minutes later I was rebooting my computer, having been unable to figure out how to do anything --- including exit the program!
Don't give up! Things have gotten a lot easier since my first days using Linux. These days, Emacs is pretty easy to figure out. If you start it up from your GUI, …
About Control-Escape
Our Mission
To foster, educate and expand the Open Software community. At Control-Escape, our goal is to help bring new citizens to the open software community, a cultural group existing mostly on the Internet and based on the values of cooperation, sharing, and technical excellence. We seek not just the spread of open software, but of the values inherent in the open software community.
We don't go around trying to enlist new recruits. Our community isn't like that (or shouldn't be, at least). We simply spread the word, figuring that if we build it, you will come. But once you come for a visit, we will try our best to make your stay pleasant, to make you want to live here.
As with any move to a new community, there is a period at the beginning when you don't know your way around. We try to alleviate that "lost puppy" feeling by providing you with the information you need to find your own way. Unlike many other resources, Control-Escape is designed to be accessible to the novice, the new and prospective user, as well as the power user.
We believe that the GNU/Linux operating system is …
Linux -- A Primer for the Impatient
Getting Help from Linux
Once you have Linux installed and running, the most important piece of information you need is how to get help. There are megabytes of documentation right there on your Linux system that can answer all of your questions, if you just know how to access it!
man
Pages
The standard way to get help, which works on any UNIX system, is a command called man
(think "manual", as in user handbook). To get help on the grep
command, for example you would type: man grep
This displays a help screen describing the program and its usage. Man pages, as they are known, are formatted on the fly from special source files, and are displayed using the
pager program less
. You can scroll back and forth line by line with the arrow keys or whole screens using the PgUp
and PgDn
keys. When you're done reading, press Q to quit (the escape
key will not get you out of less
) and you'll get back to the command prompt.
Man pages are stored in a categorized database. These are the standard categories:
- User Commands
- System Calls
- …
Compiling Linux Software from Source Code
A computer program is a list of instructions given to a computer to make it perform a specific task or series of tasks. Computers do not understand English (we all wish that they did!), so programmers must communicate these instructions to the computer in a language the computer understands. Computers, however, can only operate on numbers, which makes a computer's language very difficult for humans to understand.
The solution to this problem is to create an intermediate language that both humans and computers can understand. These are called programming languages. Programmers create a list of instructions for the computer in a programming language such as C, Pascal, or Fortran. This list of instructions is known as "source code". It is textual in nature, and readable to humans (who speak the language). Programmers do all their work in this source code, changing the instructions to fix bugs, add features, or alter the appearance of a program.
When the programmer believes he has perfected the instructions for his program, he uses a special program called a compiler to translate his human readable text instructions into computer readable numbers that correspond to the same instructions. The resulting file is usable by …
Managing Linux Software With yum and rpm
I have been planning to update this article to contain detailed information on configuring and using yum
to manage Linux software. Sorry for the delay, but there are only so many hours in the day. For the moment, the best resource for learning about
yum
is the official documentation at
Managing Software with yum. Meanwhile, here is some background on RPM, which is the technology underneath yum
.
RPM is the Red Hat Package Manager. Red Hat invented the thing, so naturally you will find it in Red Hat Enterprise Linux as well as their less commercial Fedora distro. It is also supported by S.u.S.E. Software gets wrapped up into these RPM packages that you can download from the Internet. You use the rpm
utility to install them, and it keeps track of version information and changes made by the install so the package can be uninstalled or upgraded later if you choose.
The syntax of rpm
is pretty simple. To install a package:
[root]# rpm -i ${packagename}
If you already have an older version of the program installed and you want to upgrade to a newer version:
[root]# rpm -U ${packagename}
Remember …
Where did the files go?
After you have installed your software, you may be left asking, Now what?
You are probably staring at a command prompt or a message saying your software package has been installed. But where did it go? How do you start the program? This is one of those mystical Linux moments when you realize that you are a fish and this is not the water you are used to.
If you are using a graphical desktop (KDE or Gnome), the good news is that your newly installed program probably also has a newly installed icon and entry in your programs menu. The bad news is that the menu is so large and poorly organized on most systems that you may not be able to find it.
On the other hand, if you were installing a server or a command line utility, you probably will not find it in your menu no matter how hard you look. So let's take a quick tour to find out where files live on your Linux system. (You may first want to read about the Linux Virtual File System for some background.)
User Programs (binaries)
/bin
- Essential user commands
…
Editing files with vi
The thing you have to understand about vi
and its work-alike editors is modality. Most programs have just one mode, accepting input and placing it at the cursor. This is what you probably expect from a program. But vi
has other modes. When you start vi
, you'll be in "Normal" mode, which is really command mode. When you are in Normal mode, whatever you type is considered not to be input, but commands that vi will try to execute.
This may sound a little crazy, but it is actually a very powerful way to edit documents. Even if you hate it, the ubiquity of vi
means that you're going to need to learn the basics, because sometimes you just have to use it. On the other hand, if you enjoy working at a command line, then you may end up loving vi
.
Lesson 1: How to Quit vi
Since vi
is the default editor, there's a good chance you got dropped into it without knowing it. This can be extremely frustrating if you don't know your way around the program.
To exit vi
without saving changes, hit Escape
a couple of …
Linux Command Line Basics
Linux Command Line Basics
What is this "shell"?
The "shell" is another name for the command shell or command interpreter. This is the program that gives you a command prompt, accepts the commands you type there, and basically makes the computer do what you tell it to. In DOS the program that did this was command.com (unless you were a real technogeek and used 4dos or something). In Linux, the shell is the first program that starts when you log in, and it keeps running until you log out, waiting to do your bidding. Linux is able to use any of several different shells, but the default Linux shell is called bash and is the only one I will discuss.
Why It Is Called a Shell
The shell's job is to interpret your commands and run the programs you request. Linux was designed to be a multitasking operating system, which means you can run more than one program at one time. Linux was also designed as a multi-user OS, which means that you can have more than one shell running at the same time. (Each user gets his own shell at login.) As a user, you …