Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Django 2 Web Development Cookbook - Third Edition

You're reading from  Django 2 Web Development Cookbook - Third Edition

Product type Book
Published in Oct 2018
Publisher
ISBN-13 9781788837682
Pages 544 pages
Edition 3rd Edition
Languages
Authors (2):
Jake Kronika Jake Kronika
Profile icon Jake Kronika
Aidas Bendoraitis Aidas Bendoraitis
Profile icon Aidas Bendoraitis
View More author details
Toc

Table of Contents (14) Chapters close

Preface 1. Getting Started with Django 2.1 2. Database Structure and Modeling 3. Forms and Views 4. Templates and JavaScript 5. Customizing Template Filters and Tags 6. Model Administration 7. Security and Performance 8. Django CMS 9. Hierarchical Structures 10. Importing and Exporting Data 11. Bells and Whistles 12. Testing and Deployment 13. Other Books You May Enjoy

Deleting Python-compiled files

When you run your project for the first time, Python compiles all of your *.py code in bytecode-compiled files, *.pyc, which are used later for execution.

Normally, when you change the *.py files, *.pyc is recompiled; however, sometimes when switching branches or moving the directories, you need to clean up the compiled files manually.

Getting ready

Use your favorite editor and edit or create a .bash_profile file in your home directory.

How to do it...

  1. Add this alias at the end of .bash_profile, as follows:
# ~/.bash_profile
alias delpyc='find . -name "*.pyc" -delete'
  1. Now, to clean the Python-compiled files, go to your project directory and type the following command on the command line:
$ delpyc

How it works...

At first, we create a Unix alias that searches for the *.pyc files and deletes them in the current directory and its children. The .bash_profile file is executed when you start a new session in the command-line tool.

See also

  • The Setting the Subversion ignore property recipe
  • The Creating the Git ignore file recipe
You have been reading a chapter from
Django 2 Web Development Cookbook - Third Edition
Published in: Oct 2018 Publisher: ISBN-13: 9781788837682
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}