Friday, August 31, 2012

Re: How to package a django application

On Fri, 31 Aug 2012 04:49:39 -0700 (PDT), Muhammed Salman
<salmanmanekia@gmail.com> declaimed the following in
gmane.comp.python.django.user:

> Thanks for the reply. Maybe i should have gone into more details on what i
> have to actually do. I am sorry for not being clear and hence you kept
> guessing. The app requirments are simple it requires that the client is
> shown a user id and password field and if the user id and password matches
> a particular criteria i.e (userid : login@login.com and password:
> password), then it shows this as a sucess else it displays login fails.
>

That's all?

Is the "particular criteria" something you can hard-code (that is,
there are only two or three "good" values) or do you have to read from a
database of "users"?

For the rest: I think all you need is an instance of CGIHTTPServer
(go back to the library reference manual), and three "forms" (initial
"login", "success", and "fail" pages). Oh, and the cgi module to get the
values...

Actually, you might not need CGIHTTPServer -- a
SimpleHTTPRequestHandler with some parsing of the request in a do_PUT()
method may be all...

{Note: the module names are Python 2.x, check documentation for
http.server if using 3.x}

... <time passes>

Minimalistic index.html (login form) took 33 lines of HTML
server.py took 9 lines of Python
cgi-bin\login.py (CGI handler for form) took 44 lines of Python

And only about 30-45 minutes to create.

Granted, no use of cookies (so there is no session state -- it JUST
presents a login form, compares (user, password) against a preset list
of valid (user, password) pairs, and returns either "Congratulations" or
"Failure" text. A fully functional system should set a cookie, and any
attempt to access pages other than index.html when not validated should
reset to index.html.





--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment