Is learning Django without initial knowledge of Python possible? - python

I am coming from procedural PHP with fair amount of knowledge on it. I want to learn Django but I don't have initial knowledge of Python. Can I learn Django at the same time also learning Python? Thank you so much!

No. You'll be writing Python code. In Python. You'll have to learn Python.
A little bit of your project will be CSS, JavaScript and HTML with template tags inserted.
Most of your project will be Python.

Yes! It's called 'immersion.' You learn Spanish by speaking Spanish. You learn Python by writing Python. Having a concrete project ("I'm going to make webapp that does xyz in Django") in mind gives you something to work on and towards. If you have the time and the determination to stick with it, and useful resources at your disposal (google, SO, docs), this is a great way to learn. It helps to be a certain type of person (stubborn, willful, patient).

I would suggest it's possible, but definitely steepens the learning curve. When learning a new language, I usually enjoy using it to actually do something useful rather than just writing Hello World programs. Learning Django while learning Python at the same time might be a good way to do this.
I did learn Ruby at the same time as I learned Rails, and I did find myself having to lookup basic Ruby syntax every 30 seconds, but I eventually got the hang of it. I found that looking at some of the weird Rails constructs pushed me into having to learn various Ruby features that I might have not run into on my own as well, so that was an advantage.
I would say give it a shot, and if you find the whole thing overwhelming, then back off a bit and focus on some command line scripts or other simple programs.

Short answer: no.
Long answer: Learning a framework for a particular language is essentially taking the basic syntax with its nuances, and adding a new level of complexity to it. You're coming from a different language with a different semantic structure, so you would require time to both understand what Python's doing, and how it's doing it with Django.

Learning Python through Django is like learning PHP through wordpress. You will learn python, but Django is it's own beast. If you are experienced in another language or web programming then you will be fine jumping into Django. If this is your first language then you need to learn basic python first.
I also recommend something lighter like Flask to start with as you will use more raw python and learn to setup your own scaffold and folder structure which will help you understand Django behind the scenes.

Related

How to study python to take part in GSoC?

I'm new to python. I have learnt the basics from learnpythonthehardway.org/book and now I'm unable to understand the codes and libraries method of my favorite projects on github.
What should I do now in step by step manner so that I become capable enough to contribute and hence take part in GSoC no matter how much time it takes?
Some says I should practise python questions on hackerrank and other says I should work on my own project and learn from it. Which should I follow?
If you are just trying to learn Python I know YouTube has a lot of fantastic resources. Since you've already read Learn Python the Hard Way, I would suggest you look for YouTube videos where the host is creating a project (Look for something which interests you), and follow along until you come across something you don't know. Research it, rinse and repeat. As a bonus, you'll end up with some neat Python projects in the end, too.
Another great way to get some Python experience is to find different sources of tutorials. I learned Python from Codecademy, but there are plenty out there.
However, all said, there is simply nothing like figuring things out yourself. Set a goal - think of a project to create - and get as far as you can, and look for as many opportunities to learn as possible. That's my favorite way to learn.
Good luck! :)
As mentioned by #Dylan, YouTube hosts a lot of Python tutorials which are helpful for learning more about Python.
Additionally, I would invest your time in reading some eBooks. They have a wealth of knowledge that can expand your horizons beyond learning the basics of Python and personally I found it to be a huge help in understanding the language. Read these and take some good notes.
Python Cookbook (Second or Third Edition) by David Beazley
Automate
the Boring Stuff With Python by Al Sweigart
A Byte of Python by
Swaroop C.H.
Test-Driven Development with Python by Henry Percival
Real Python for the Web by Michael Herman
Good luck and happy coding!
I use C/C++ language to develop monitor and control software for hardware device for many years. Recently I started to learn Python for some reasons, so I also wondering which way is the best way to study a new language. My learning materials are two books, Learning Python and Programming Python. I think the language's foundational concepts are really important. As my experience in C/C++, the most frequent book I use in my work is the first one I studied in University, as that book focused on the foundational concepts. So I think the most important thing is understanding the foundational concepts,and the best way is typing it and test it by your hand, not only seeing the example.

Dive into Django right after scratching the surface of of Python, good choice?

Little bite background: I joined a software company three years ago after graduated with art degree. It is fair to say I had not touched any code and never thought of that program thing before I joined the software company.
At the software company I dabbled into HTML, CSS, JS and SQL, and it turned out learning those languages were not so hard at all. I lean these languages just for developing apps or web site to see how it works, not for the sack of money or career. I just simply curious, and when I play with those language it makes me fell good, very good. I have built my own static web site, and now I am directing our web developers. now I want to lean something more powerful which could help me understand how dynamic web site works
Hanks to SO, I lean that Python is a very good language for people like me, and I spend couple of months to read and write some simple code when I get home from work. Printing "hello world" or slicing data or writing if a then b if c then d does not give me any felling of achievement. That is why I have picked Django up, which so far is more interesting than Python. I have wrote poll app, blog, photo app etc. by following tutorials.
As I expected, now I feel my python knowledge is limited and it hinders my further explore.
I need your help!
RECAP
No CS background, just arts
Do not have much time, have to work more than 8 hours
Just want to lean web development
Medium knowledge of JS and SQL, good command of HTML and CSS.
It's a great choice. I might even argue it's a great way to learn python, because the documentation for Django is so amazing, and the path to progress so clear-cut and defined, that it keeps things interesting as well as structured.
I learned python on django, with no python/CS background as well. At first, I couldn't tell the difference between python and django :) I say the fit is even better with some experience with HTML/CSS/JS/SQL, as that's ultimately what you are producing with Django.
Learning Python is a rather open ended idea, and the applications of that knowledge require much more understanding than using a framework to build highly functional code that's at first, mostly the framework doing the work and perhaps a few lines of your own code.
Update: to adress your time problem and your direct goal of learning web development beyond static HTML/CSS, I can't think of anything faster than running django (particularly with your background): http://docs.djangoproject.com/en/dev/intro/tutorial01/
There are python web frameworks where you can launch a page, including installation, in about 10 total lines of code but none will match the docs of django.
http://webpy.org/
http://denied.immersedcode.org/ (1 large .py file with all dependencies inside)
I think the alternatives won't be a good tool to learn python but a useful tool once you're comfortable with python.

What's a good resource to build my first python project?

I'm tired of books and tutorials who walk me through how to print things before I can do anything fun. I want to build simple apps or programs. Any suggestions for where to start so I can make and learn at the same time?
If you're just looking for something to do that will challenge you to start actually using Python rather than reading about it, try the Ruby Quiz. You don't have to use Ruby to create solutions.
Each quiz is a problem that can be scripted (using any language, really). Ideally it'll force you to apply the concepts you've been reading about to "real life" problems.
If you are tired of tutorials, then just start building something. Anything. If you get stuck, glance back over the tutorials, or consult the documentation. I'm a big fan of learning by doing.
A short list of options from off the top of my head:
If you're into web development, Django is a popular python web framework that is very well documented. The Blog app is a popular starting point.
Python itself is pretty well documented. If you're a complete beginner to python AND programming in general, you may want to try something less complex. Pick a random task and try to do it using python:
Read and print the ID3 tags from all your mp3 files using mutagen.
List or download your email using the python imaplib or poplib modules.
Write a zip/unzip utility using zipfile.
Don't be in too much of a hurry, and be realistic. Unless you've got a pile of programming under your belt, you won't be able to jump into a complex project after reading a few tutorials. Patience and practice will get you to the place where you can tackle really interesting projects. Impatience will merely lead to frustration.
Might i suggest pygame http://www.pygame.org/news.html ? If you want to do things with visuals, your not going to get anywhere with the default python modules unless, of course you know how to implement SDL. As stated above in the comments, the tutorials are there for a reason; although they are simple, they are meant to teach you the basics and perhaps, have you think about ideas of implementing such given tools to larger projects. Give pygame I try. You can create a window with lines and shapes in a little as ~10 lines. From there you can expand your knowledge to Object-Oriented programming(which a must for UI) and be on your way to larger projects such as AI, graphics, etc.
P.S. Check this book out http://apress.com/book/view/1590598725. Although you might not want to get into game development, it will teach you some rather useful techniques which may help your research in application development.

Once I know the basic elements and syntax of Python, what should I do?

Well, I have read several user guides and watched dozens and dozens of video tutorials on how to program with Python, and feel pretty confident about writing simple applications for it. My main point in my question is, where would I be able to learn more advanced programming knowledge about Python?
How simple of applications are you making? Have you gone through the exercises in Google's Python Class? I highly recommend going through those. If you really know what you are doing, you should breeze through them. If not, then you'll be learning some valuable skills and becoming a little more experienced in Python.
After that, it depends on what your end goals are with Python. If you don't have any goals then you should work on setting some goals and making some small applications to develop your skills in the areas that go well with those goals.
Also, a good way to learn more about Python is to try to answer the questions posted on here about Python. Even if you don't find the best answer, reading other people's answers will help you as well as the process of trying to find the answer.
You could try something like Python Cookbook or Python Challenge.
But your question is a little too vague. Why did you learn Python? What kind of problems are you looking at solving? Based on the answer to that, I can direct you to various modules like os, sys, Tkinter, etc
You have given yourself an answer:
and feel pretty confident about
writing simple applications for it
go ahead and write more complex applications!
The issue here is that you do not feel challenged, and you assume that you are done with your basic learning. Just find what to do! Simplify a process (say, file management), retrieve data from Internet (say, the last 25 twitter posts about Python), consolidate your mail clients into a single command line application, etc.
The MOST productive thing you could do (assuming you really don't have problems of your own), is to find an open source Python project (say, Matplotlib) and become a contributor. You will quickly realize that Python is beautiful, but it is a beast nevertheless.
If you still feel unchallenged, contact me and I will send you a ton of stuff to code which, believe me, is not easy.
Good luck!
my favorite way in learning python is ( learning through projects ).
put yourself a goal , like a software for example ( 6 years ago when i started to learn python i picked a messenger . so i had to read more about sockets, network programming , and interfaces libraries ) . start with it , look for examples and resources to learn more . then do it.
the key is NOT TO GIVE UP and keep trying and searching until you make it .
. this can be fastest and the most efficient way in learning any programming language .
good luck ;)
If you like puzzles, you might check out Project Euler. It has a variety of interesting puzzles (some easy, some much harder) that take some logic and programming to solve. (Often you have to find a clever way to solve them, since brute-force methods will take forever.)
If you're at all interested in web development you might look into Django. It's a very nice web framework that lets you use Python; it's mature and quite powerful.
I also second Arrieta's suggestion of finding an open-source Python project and looking into getting involved. You can find a list of such projects on GitHub, freshmeat, and SourceForge, among others.

General questions regarding Python language

I'm a newbie to programming and I've decided to start with Python. Just curious though, is it enough/recommended to learn Python from online tutorials or from books? I want to go further than simple "Hello World!" programs. I'm not sure if books will actually teach you how to make more advanced programs.
One example is Exif-py. How do you even start programming a program like this? Do you just sit down and start writing the code, or do you have to search for APIs or anything? I went through the code briefly and it all looked alien to me.
I'm not really sure how to express my questions into words, so do check back because I'll edit my question if the right words come to me.
Well, I learnt all my Python from online sources (not just tutorials, but reference documentation, blog posts and other texts). It's certainly possible, although some people prefer the "guided" way a book teaches you, particularly people new to programming (at that point I had already been programming for years).
To create a program such as Exif.py, you would first have to know what you must do in broad terms BEFORE starting to program. You would study the EXIF format, then figure out how that is put into the image files, then you would have to formulate that in terms of the language you're using (in this case, Python). This usually requires that you're already familiar with it, otherwise it'll be a fairly slow process.
I'd suggest starting with simpler programs to begin with, or maybe follow a book such as Dive Into Python (free online), seeing as you're new to programming, and need to not only learn the language, but to think like a programmer.
The tutorials are there to teach you the language syntax and the standard library, not really on how to solve a particular programming problem. Think of what you learn there as your toolbox.
I think I understand what you are saying. You want to break above and beyond the simple applications and write your own stuff, right? Well, first you need to figure out what it is you want to make. Then comes the hard part; how are you going to make it? I'd suggest starting by trying to break it down into a number of small simple problems instead of tackling it as one large problem.
If you are trying to find examples of larger projects, I'd suggest looking at the Python Cheeseshop (package index) and download a few packages you've heard of to see how they did it. Also, people often post handy pieces of code on their personal blogs and that shows up on PlanetPython.
If stuff like recursion, modules, classes, iteration, exceptions, dictionaries, are indeed new to you, I suggest How to Think Like a Computer Scientist in Python (lovingly abbreviated as ThinkCSPy in the community ;-).
It is a bit outdated - for best results, use Python 2.6 or lower, but then again 3.0 is not that different.
EDIT: If ThinkCSPy has little to teach you, try Dive Into Python. It's advanced and pretty "real-world", but step-by-step.
If by 'newbie to programming' you mean that you just started it last week or something along the lines, then maybe you might want to give the MIT OpenCourseWare Introduction to Computer Science videos (and homework!) a bit of your time.
The opencourse covers the syntax of the Python language, some helpful hints and general do's and don'ts that apply to any programming paradigm.
Though, if by 'newbie to programming', that you already know the basic concepts you need to start writing basic programs (like adding, subtracting, multiplying, logical operations, functions etc).
If so, Project Euler is particularly good for exercising that cranial muscle in problem solving via programming, though most of the problems on the site require you at also have knowledge of mathematics (and if you don't, at least know how to google).
Just remember, if you get stuck on anything don't get put down! It's all part of learning! If you're really stuck, search SO!
There are a few very good online resources:
The Python Tutorial.
Dive Into Python. Python from novice to pro.
Code Like a Pythonista: Idiomatic Python
Another list of resources: Essential Python Reading List.
Most Python books I've seen so far are "not that good" - but that depends
on your background / prior knowledge about Python and programming.
You study the EXIF format, study the GIF/JPEG format, open the binary file, scan it and get the data out.

Categories

Resources