Technical

Technical

Talk on Natural Language Processing at Indian Institute of Science, Bangalore

As usual this post was in my todo list for a long time, finally on 1st day of the year I feel I have some time to aggregate all that I have in mind about the event. It first started when I got the news about Miss Annapoornima Koppad becoming the one of the 12 […]

Read More
Technical

How to POST Python requests with CSRF token ?

import requests client = requests.session() # Retrieve the CSRF token first URL = ‘http://www.example.com/’ client.get(URL) # sets cookie csrftoken = client.cookies[‘csrftoken’] print csrftoken #Check if it’s getting printed. Sometimes key name could be ‘csrf’ only payload = { ‘csrfmiddlewaretoken’:csrftoken, ‘key1′:’value1’, ‘key2′:’value2’, ‘key3′:’value3’ } r = client.post(URL, data=payload, headers=dict(Referer=URL))

Read More
Technical

Running two Flask applications under one AWS instance using Apache

Running two Flask applications under one AWS instance using Apache Have two application files copied in /var/www Application 1:- /var/www/apple Application 2:- /var/www/banana Create two wsgi files at both the above location with below content:- apple.wsgi ************************************* import sys sys.path.insert(0, ‘/var/www/apple’) from app import app as application ************************************* banana.wsgi ************************************* import sys sys.path.insert(0, ‘/var/www/banana’) from […]

Read More
Technical

How to host a Flask app on Amazon AWS in 5 minutes ?

Apache Configuration for Amazon AWS Location:- /etc/apache2/sites-available/amazonaws.com.conf NameVirtualHost *:80 ServerName ec2-52-20-211-238.compute-1.amazonaws.com WSGIScriptAlias / /var/www/aira/aira/aira/aira.wsgi Order allow,deny Allow from all ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel info CustomLog ${APACHE_LOG_DIR}/access.log combined Enable the above file which we created. sudo a2ensite amazonaws.com sudo a2dissite 000-default ———————————————————– Location of app.py :- /var/www/aira/aira/aira/app.py Location of .wsgi:- /var/www/aira/aira/aira/aira.wsgi Content of aira.wsgi ********************************************** import sys […]

Read More