Zero to Django in 4 months - What I've learned - Part 1

  • Fri 05 October 2012

  • Four months ago I started working on a Django project. Little did I know what I was getting myself into. In four months I have completed two Django projects. This blog post is an attempt to sort of show the progression of n00b to less of a n00b (I still very much feel like a child, but I have accomplished some amazing [to me] things).

    10,000' view

    Project One:

    ## requirements.txt
    Django==1.4
    PIL==1.1.7
    distribute==0.6.24
    django-crispy-forms==1.1.4
    gondor==1.1
    gunicorn==0.14.3
    psycopg2==2.4.5
    wsgiref==0.1.2
    django-orphaned==0.1
    django-thumbs==0.4
    django-robots==0.8.1
    South==0.7.5
    
    • 4 Apps
    • 2219 lines of code

    Project Two:

    ## base-requirements.txt
    --extra-index-url=http://dist.pinaxproject.com/dev/
    --extra-index-url=http://dist.pinaxproject.com/alpha/
    
    Django==1.4.1
    Pillow==1.7.7
    argparse==1.2.1
    django-appconf==0.5
    django-forms-bootstrap==2.0.3.post1
    django-thumbs==0.4
    django-user-accounts==1.0b1
    metron==1.0
    pinax-theme-bootstrap==2.0.4
    pinax-theme-bootstrap-account==1.0b2
    pinax-utils==1.0b1.dev3
    pytz==2012c
    wsgiref==0.1.2
    South==0.7.6
    django-crispy-forms==1.1.4
    
    ## dev-requirements.txt
    -r base-requirements.txt
    
    django-debug-toolbar==0.9.4
    ipython==0.13
    django-extensions==0.9
    
    ## prod-requirements.txt
    -r base-requirements.txt
    
    gondor==1.1.4
    gunicorn==0.14.3
    psycopg2==2.4.5
    
    • 5 Apps
    • 6794 lines of code

    I think it's fascinating in itself to see that my first project used the default 'requirements.txt' and my second project broke my requirements up based on the environment. This allowed me to have only applications in their respective environments. Any overlap existed in base-requirements.txt. I had never seen/heard this done before, I simply wondered if it was possible and was pleasantly surprised when I found out that it was in fact possible! Much like separating your settings.py based on environments.

    In regards to the 10,000' overview, what else I learned:

    • Django-cripsy-forms are awesome
    • pillow > PIL
    • pip install ipython (in your virtualenv)
    • django-extensions -- ./manage.py shell_plus + iPython FTW!
    • South - learn it! (it is very likely you will bleed -- backup OFTEN!)
    • django-floppy-forms -- note I'm not using them (learned about this late in the game, but these projects will be retro'd)
    • pinax-theme-bootstrap - I'm torn on. It's VERY COMPLEX. The first project I just bootstrapped "manually". I LOVED what Pinax is/was, so I decided to give it a go. Not sure if I'd use it agian.
    • django-user-accounts -- Use it! AWESOME! First pjoject I built my own Django login/logout. NEVER AGAIN! Word of Caution -- like pinax-theme-bootstrap, django-user-accounts is also VERY COMPLEX and there is a learning curve.
    • django-debug-toolbar -- Use it! Helps tremendously with templating, wondering how/where stuff is loading, etc. When it comes time to figure out why stuff is slow, also insightful!
    • django-extensions -- ./manage.py runserver_plus even more awesome!

    What I learned about Django and it's community:

    Getting help was hit or miss. First recommendation would be, skip Google, go straight to StackOverflow. Learn the search syntax to narrow results. Why skip Google? Most of the results seem to be YEARS old (yes, there are means to modify your search by year, but my experience, there doesn't seem to be a lot of new/current content (at least on the first page of results)).

    Django's documentation can either be REALLY good, okay enough to be able to make 2+2=4, or almost non-existent. Yes, this is being addressed, people are actively making this better. That didn't help me as I bashed my head against the wall continually. Speaking of Django's documentation, sometimes the search works, other times it doesn't AT ALL. This is frustrating! VERY FRUSTRATING! When this happens, take a deep breath, step away, and come back later. Something I learned, once you found your page. Bookmark it!!. Build your own documentation from a collection of bookmarks.

    Getting help via IRC was very interesting. I overcame many obstacles with the help of IRC, and then there were nights in IRC as if I were invisible. It wasn't uncommon to get a "read the source, it reads like English". It may read like English to someone with Python experience. I ha[d|ve] none. So when told to read the source, I might as well be reading Japanese. I will admit, after 4 months, I'm less apprehensive to read the source, and have figured out a few of my problems by reading the source...this is (in my opinion) a shortcoming of the documentation, going to the source seems like it should be the absolutely LAST thing you should have to do. Of course that's just my opinion and it's likely that others with beards longer than mine are saying "STFU n00b". Unlike IRC, Twitter was a little better at getting support. Not so much at general questions, but if you want to reach out to a plugin/module's author, they're often receptive and helpful to a ping and question(s). Like the Python community, the Django community is equally [un]inviting. VERY tight-knit group, hard to break that shell to become a part of the circle. This of course has just been my personal experience, other's experience will likely vary.

    What I've learned about myself:

    • I am completely capable of working 120 hour weeks
    • Like someone wiser than me said, it's possible, it's not sustainable.
    • I can learn anything.
    • I need to learn to walk away sooner. Or rubber duck it sooner. I'm too stubborn to walk away, but it's often after I've walked away that I've figured it out.
    • Burnout didn't occur. Even with 18+ hour days, less than 2 weeks total off in the last 4 months while working my "normal" 40. But I definitely got beat, A LOT.
    • Mt. Dew Amp == Bad; Monster Low Carb == Good
    • Even though there is over 8000 lines of code, I still don't feel like I know Python. In my opinion (and I know this is wrong). Django != Python

    The title of this post is 'Part 1'. In the other parts, I'd like to address the things that I learned. The things in my opinion other new comers (such as myself) may come across, and perhaps this will help them have a better experience than I did (not that the experience was entirely bad). So I'll close here.

    More to follow.

    Comments !

    social