I see, your actual problem is not really related either to packaging a
django app or to using custom script. are you using django's in built user
model ? if yes, then you can do something like this.

from django.contrib.auth import authenticate, login
from django.shortcuts import render_to_response

def login(request):
    if request.method == 'POST':
        username = request.POST['username']
        password = request.POST['password']
        user = authenticate(username=username, password=password)
        if user is not None:
            if user.is_active:
                return render_to_response('login_succes.html', {'user' :
user})
            else:
                return render_to_response('activate_account.html', {'user':
user})
        else:
            data = {
                'error' : 'Username and Password does not match'
            }
            return render_to_response('login_failed.html', {'data' : data})

On Fri, Aug 31, 2012 at 5:22 PM, Muhammed Salman <salmanmane...@gmail.com>wrote:

> Thanks Amyth, Can you please see my reply to Dennis. I have further
> explained it there what i am exactly looking for ...
>
>
> On Friday, August 31, 2012 9:00:06 AM UTC+3, Amyth wrote:
>
>> Using pure python scripts with django is not all that difficult, as
>> django itself is a python package. So , you can simply have a custom script
>> "mailserver.py" (or whatever name) and you import the script to your views
>> and simply call the functions from your custom script under the respective
>> user request. For Example:
>>
>> Custom Script = mailserver.py
>> def sendWelcomeEmail(to, from):
>>     """ Function to send a
>>          Welcome email to First Time Subscribers.
>>     """
>>
>> Django App's Views.py
>> from django.http import HttpResponse
>> import mailserver
>>
>> def firstTimers(request):
>>     usermail = request.POST['email']
>>     mailserver.sendWelcome(**useremail, 'myn...@mydomain.com')
>>     success = '<html><body><h1>Mail Sent.</h1></body></html>'
>>     return HttpResponse(success)
>>
>> On Fri, Aug 31, 2012 at 10:51 AM, Dennis Lee Bieber <wlf...@ix.netcom.com
>> > wrote:
>>
>>> On Thu, 30 Aug 2012 19:45:20 -0700 (PDT), Muhammed Salman
>>> <salman...@gmail.com> declaimed the following in
>>>
>>> gmane.comp.python.django.user:
>>>
>>> > Hi,
>>> >
>>> > I am new to python and django development and have developed a simple
>>> email
>>> > based authentication form as a part of an exercise. Now, i have two
>>> > questions
>>>
>>>         I'm not sure I understand what you mean by "email based
>>> authentication form"
>>>
>>>         Taken literally, to me it implies that you have a template email
>>> in
>>> which someone fills out fields and sends it to "you", whereupon you will
>>> take the information in the email, validate it, record it in some user
>>> database, and email back some random account name and password.
>>>
>>>         Or it could mean you are supposed to have a web-page for users to
>>> register, you record their name, password, and email address in a
>>> database but do not activate it yet, then send an email to them with
>>> instructions that they reply to it if they are really the person who
>>> attempted to register. Then when you receive the reply you match it
>>> against the database and activate the account.
>>>
>>> >
>>> > 1: The requirement from me for this exercise was to create it without
>>> any
>>> > frameworks but i started it with django so its easier initially and
>>> indeed
>>>
>>>         Mistake #1 -- the time spent developing in Django could have been
>>> spent studying the core Python library, which is what your "without any
>>> frameworks" indicates.
>>>
>>> > it was.So, can someone please tell how to move from this point. I mean
>>> if
>>>
>>>         Obviously, by starting over from scratch.
>>>
>>> > the email authentication has to be done purely in Python (so that it
>>> works
>>> > like "python server.py") how difficult it is and what could be a few
>>> good
>>> > resources to get start with that.
>>>
>>>         Are you supposed to implement an SMTP daemon to receive/deliver
>>> email messages, or only periodically read inbound email from a POP3
>>> mailbox?
>>>
>>>         I'd suggest you start with the documentation for your version of
>>> Pyhthon... In particular the "Python Standard Library" manual. Try the
>>> chapter on "Internet Protocols and Support" (in my copy, for Python 2.7,
>>> this is chapter 20), SimpleHTTPServer (20.19) and CGIHTTPServer (20.20),
>>> poplib (20.9), smtplib (20.12), maybe smtpd (20.13).
>>>
>>>         On top of that, the chapter on "Internet Data Handling" (chapter
>>> 18
>>> in my copy), email (18.1), mailbox (18.4)
>>>
>>>         "Data Persistance" (11), sqlite3 (11.13)
>>>
>>>         If you need a more capable server than the two mentioned above,
>>> check the chapter "Interprocess Communication" (17), asyncore (17.6)
>>>
>>>
>>> > 2: I also have a time deadline for this. So if i am not able to do it
>>> > purely with python which packages/files/folders should i send to the
>>> > teacher and what instructions shall i wrote in the readme to make sure
>>> that
>>> > my application run on his machine with the least fuss.
>>>
>>>         I would think the instructor wouldn't have given you a "no
>>> frameworks" requirement if they expect assignments to have dependencies
>>> on outside packages.
>>> --
>>>         Wulfraed                 Dennis Lee Bieber         AF6VN
>>>         wlf...@ix.netcom.com    
>>> HTTP://wlfraed.home.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...@googlegroups.com.
>>> To unsubscribe from this group, send email to django-users...@**
>>> googlegroups.com.
>>>
>>> For more options, visit this group at http://groups.google.com/**
>>> group/django-users?hl=en<http://groups.google.com/group/django-users?hl=en>
>>> .
>>>
>>>
>>
>>
>> --
>> Thanks & Regards
>> ----------------------------
>>
>> Amyth [Admin - Techstricks]
>> Email - aroras....@gmail.com, ad...@techstricks.com
>>
>> Twitter - @a_myth_________
>> http://techstricks.com/
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/4fZoFKUR0-EJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Thanks & Regards
----------------------------

Amyth [Admin - Techstricks]
Email - aroras.offic...@gmail.com, ad...@techstricks.com
Twitter - @a_myth_________
http://techstricks.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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to