I'm jumping into Python/Django, and have been hitting some speed bumps. I'm a somewhat novice programmer. I know the basics, but haven't done anything more than create a PHP webform, and build very simple websites. I have a thousand questions about Django (most centering around Views and customizing the Admin, specifically as they relate to querying the DB), but I'll start with this seemingly simple one, and hopefully someone can help me out.
In views.py, I begin with 'from django.http import HttpResponse'. I then create a boring function:
def hello(request) return HttpResponse("Hello world")
Seems simple enough, right?. While reading the django book, however, I learned that 'request' is "an instance of the class django.http.HttpRequest." This is where I get confused. I've never instantiated a class by simply typing a word. I have very little experience with OOP, but every time I've seen it and done it, it worked something like this:
from django.http import HttpRequest request = HttpRequest()
That is how I thought an instance of the django.http.HttpRequest class woule be instantiated. There is so much of Django that is leaving me with questions that seem so simple, yet I can't wrap my head around. I'm humiliated that I can't get this. All I've read about the framework is that it's easy to pick up and quick to develop with. I tried to build a simple group-like site (posts and replies), but nearly smashed my computer because of how difficult it became. If I was using PHP and MySQL, it would have been slower to develop, maybe, but undoubtedly would have been completed. With Drupal, it would have taken all of 60 seconds.
Anyway, if someone can answer this first question, I would be grateful. And if the answer is plainly obvious, and you think I'm a moron, that's fine. Please, though, I'd still appreciate some help. Thanks in advance.