0

I am new for python so if you can help me to solve my problem. I want fetch Username and Password from angularjs to python script In my python script then what mechanism i want to follow to achieve this gole.


html code

<form  action="" method="post" id="homeTitle">
<table width="20%">
<tbody>
<tr><td></td><td></td></tr>
<tr><td><label class='lblUserEmail'>
Email</label></td><td align='center'>
<input id='Email' type='text' style='background-color: rgb(250, 255, 189);' ng-model='Email'>
</div></td></tr>
<tr><td>
<label class='lblPassword'>Password</label></td>
<td align='center'><input id='password' type='password'style='background-color: rgb(250, 255, 189);' ng-model='password'>
</div>
</td>
</tr>

<tr>
<td></td>
<td align='right'>
<button id='Login' name='Login' class="btn btn-primary btn-lg" ng-click="checkLogin()">
Login
</button>
</td> 
</tr>

</tbody>

</table>

</form>

angularjs code

$http.post("/python/index.py/", user_data)
                .success(function(response) {
                    //console.log(response);
                    $http.defaults.headers.common['Authorization'] = 'Token ' + response.token;

                    // $rootScope.toke = response.token;
                    // console.log($rootScope.toke);
                    //$location.path("/dashboard");
                    var toke = response.token;

                    //console.log(toke);
                    $rootScope.$broadcast('event:login-confirmed',toke);

                jQuery("#loginBox").slideUp(function(){jQuery('#blanket').css({'display':'none'});});
                jQuery('#homeTitle').css({'display':'none'});
                jQuery(".bottomImages").slideDown();
        });     
    };

Iam not using Django Python frame work. I am trying to create ma own frame work using wsgi and python so. Help me to resolve this problem...

1 Answer 1

3

It seems you have tagged this post as Django but have not used Django yet. I suggest that you read the Django tutorial and solve this. Part 4 covers how you can create a simple form in Django, like yours.

In simple terms, your problem is that you have created the frontend to show the form but do not have a backend to take action on the form once it gets submitted. You can use any server based web frameworks like Flask, Pyramid or even Node.js for this.

Sign up to request clarification or add additional context in comments.

Comments