Skip to main content

Posts

Showing posts with the label version

Virtualenv for Django

One of main features and troubles for Django projects is the Django version you are using. Example for this would be the occasion of starting project for Django 1.4.x version. Trying to run it under Django 1.7.x would lead to various troubles, counting template changes, misconfiguration errors and so on. Solution is to use virtual environment. The tool for this is called Virtualenv . It is a wrapper for a python interpreter. It enables you to have multiple versions of python packages that run independently. The Virtualenv creates you a standalone environment. Basically it copies and keeps a system Python of yours in a specified directory. All the python packages will be installed there. (In case you have not forgot to activate it first, of course) Lets get started then. We need Virtualenv itself for the first. There are many ways to install it depending on your system . Most obvious to use pip. Your installation command will look something like that: pip install virtualenv Thi...

Git tag and versioning your project

We use tags to version our project. I will set up here basic commands we use on everyday basis and may use to handle some issues. Showing your tags Listing the available tags in Git is straightforward. Just type git tag . $ git tag 1 . 0 . 7 1 . 0 . 8 1 . 0 . 9 1 . 1 . 0 Adding tags To add tags you may do git tag tagname . But better to specify args to be able to use in scripts: $ git tag - a 1 . 1 . 1 - m "major improvements" $ git tag 1 . 0 . 7 1 . 0 . 8 1 . 0 . 9 1 . 1 . 0 1 . 1 . 1 Here we have added a tag version 1.1.1 with commit message "major improvements" . Uploading to repository I assume you have a GitHub repo. So to push your tags there run git push (for your tagged commits commits) and then push your tags: $ git push Counting objects : 120 , done. Delta compression using up to 4 threads. Compressing objects : 100 % ( 59 / 59 ) , done. Writing objects : 100 % ( 69 / 69 ) , 390 . 70 KiB , done. Total 69 (...

Delete all '.pyc' files recursively OS X

We often get strange errors with python. When you changing the source and cannot figure out why files are used from past. So if you ever get this dejavu feeling, try using this command: find . -type f -name '*.pyc' -exec rm {} \; It will delete all precompiled python sources. (Because with python you have ability to distribute your files in binaries in fact.) Those errors usually appear if you move/delete *.py files with version control. You usually exclude *.pyc files from list. Old links used this way. Debugger does not suggest wrong imports because your files are in fact there, just precompiled. Anyway I've just put this command to my blog for memorizing. It often helps me. Maybe it can for you.