The nice thing about Django is that it gives you easy, declarative-style
frameworks for doing things without a lot of work, or you get dig in and
get your hands dirty if you need to. At the end of the day, even the
declarative nature of Django is just pure python so you have a lot of
control.
The Poll tutorial contains all of the building blocks that it sounds
like you will be interested in:
1. Defining model objects to represent the data you want to collect. If
you're not familiar with object modeling, this is basically just
defining the structure of the data you will be storing and how it will
relate. For most purposes, each model object will be a database table
and each attribute in the model will be a column in that table.
2. Establishing your URL-structure. What do you want your URLs to look
like for search engine optimization or just plain friendliness to users'
eyeballs.
3. Define your forms. For your purposes, Django may just do a lot of the
form-handling automatically. In my opinion, form handling (including
synchronizing the HTML aspects of the forms with what the server-side
code is expecting is the source of a lot of error in many web
applications. Django tries to reduce that error by doing a lot of the
work for you. Again, if you don't like Django's sane defaults, you can
override where you need to.
4. Set up your views. This is where the rubber meets the road so to
speak. Your views will get called whenever the user submits a request
(or posts a form) and this is where you will ultimately collect the data
submitted in the form and persist it to the database.
Since it sounds like you have the users uploading files, you'll be
interested to know that Django has a FileField form field (that
automatically gets created if you defined your model as having a File as
one of it's attributes). This FileField gives you a lot of
functionality including handling proper streaming of large files (so you
don't run out of server memory).
You will want to look at:
Working with Forms documentation:
http://docs.djangoproject.com/en/dev/topics/forms/
File Uploads:
http://docs.djangoproject.com/en/dev/topics/http/file-uploads/#topics-http-file-uploads
FileField Model Field:
http://docs.djangoproject.com/en/dev/ref/models/fields/#filefield
Details on File Uploads:
http://docs.djangoproject.com/en/dev/topics/http/file-uploads/#topics-http-file-uploads
My apologies for the off-topic nature of this post.
-Rob
On 6/25/10 10:42 PM, Bradley Hintze wrote:
Does Django have a simple to follow tutorial on passing user input to
scripts?? I saw the tutorial on the site about making a poll but I'm
not interested in that. I want to be able to upload files, and get
input from the user.
On Fri, Jun 25, 2010 at 10:16 PM, Rob Yates<[email protected]> wrote:
I'm a bit biased as I'm a full-time Django developer, but your angst should be
with macports and not with Django. Django is a single directory that contains
no compiled code and following their fantastic documentation is really easy.
Granted Django may be a bit more functionality than you need in a framework,
but ease of installation and stellar documentation are two of it's strong
traits.
If you feel the need to use a "package manager", you really should be using
easy_install or even better pip, but not macports. Assuming you're on a recent flavor of
OS X, most of what you need is built-in to the o/s anyway.
-Rob
On Jun 25, 2010, at 9:35 PM, Bradley Hintze<[email protected]> wrote:
I am fairly comfortable with unix commands and security, I still have
a lot to learn though.
I have a bad taste in my moth for Django as I installed it and
couldn't find where the files were put, and thus couldn't follow the
one and only Django tutorial. When I asked on the Django mailing list
for help I got no response. I restored my machine to a previous
back-up to get rid of all the Django 'stuff' wherever it was. If I
could get help installing it correctly I might give it a go.
The problem that I'm seing is most these frameworks don't give you
step by step instructions on how to download and install.
How about pylons? I looked at their site and they have decent
instructions AND tutorials. Surprisingly, I have yet to come across a
tutorial outlining how to retrieve user input from a form which should
be, from my limited view, the primary function of a framework as that
is the crucial aspect of a dynamic web app. If anyone knows of a good
tutorial let me know.
Also, I've seen that some of these frameworks have you staat up their
own server. Why run their server and apache? Or can theses frameworks
use apache?
On Fri, Jun 25, 2010 at 7:02 PM, Damjan<[email protected]> wrote:
I am making an app where I pass variables and run lots of scripts. I
don't think a frame work can do what I am trying to do, manual control
is a must. Plus the framework documentation that I've seen is
difficult to understand. I was raised as a biochemist not a programmer
;) If you can point out an easy to understand frame work I'll
certainty take a look.
Since you don't have much experience with Web apps or WSGI, I'd
strongly suggest to start with some framework.
Django has pretty good documentation and even if I personally don't
use it, I think it's very good for newbies. You could also look at
flask - it has great documentation too, but you need to know more
about web apps with it - http://flask.pocoo.org/. It's perhaps on the
opposite end of the spectrum of web frameworks compared to Django, but
has good documentation too.
From your comments in this group, I would not suggest you to use plain
WSGI. You will need to understand and know much more about http, html,
security issues etc.
Also, if your application is not going to be heavily visited, you
might not need mod_wsgi either. Most WSGI frameworks come with their
own python server.
And last, learn to use virtualenv and pip, and you will be able to
pack your entire web application, including Django in a single
directory.
And lear some Unix command line interface (or shell), it will really
make your life easier.
--
damjan
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/modwsgi?hl=en.
--
Bradley J. Hintze
Graduate Student
Duke University
School of Medicine
801-712-8799
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/modwsgi?hl=en.
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/modwsgi?hl=en.
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/modwsgi?hl=en.