pip uninstall pycurl
export PYCURL_SSL_LIBRARY=openssl
pip install pycurl
from transloadit/python-sdk#4 @ifedapoolarewaju
pip uninstall pycurl
export PYCURL_SSL_LIBRARY=openssl
pip install pycurl
from transloadit/python-sdk#4 @ifedapoolarewaju
location @webserver { | |
if ($request_method = 'OPTIONS') { | |
add_header 'Access-Control-Allow-Origin' '*'; | |
add_header 'Access-Control-Allow-Credentials' 'true'; | |
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; | |
add_header 'Access-Control-Allow-Headers' 'Authorization,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; | |
add_header 'Access-Control-Max-Age' 1728000; | |
add_header 'Content-Type' 'text/plain charset=UTF-8'; | |
add_header 'Content-Length' 0; |
# Basics of Elliptic Curve Cryptography implementation on Python | |
import collections | |
def inv(n, q): | |
"""div on PN modulo a/b mod q as a * inv(b, q) mod q | |
>>> assert n * inv(n, q) % q == 1 | |
""" | |
for i in range(q): | |
if (n * i) % q == 1: |
#!/usr/bin/env python | |
""" | |
Very simple HTTP server in python. | |
Usage:: | |
./dummy-web-server.py [<port>] | |
Send a GET request:: | |
curl http://localhost |
import socket, ssl, json, struct | |
import binascii | |
# device token returned when the iPhone application | |
# registers to receive alerts | |
deviceToken = '39cac56f 986a0e66 3c4fd4f4 68df5598 024d2ca3 8b9f307c 741c180e 9fc30c62' | |
thePayLoad = { | |
'aps': { | |
'alert':'Oh no! Server\'s Down!', |
""" | |
badwords source: https://github.com/shutterstock/List-of-Dirty-Naughty-Obscene-and-Otherwise-Bad-Words/blob/master/en | |
badwords source 2: http://urbanoalvarez.es/blog/2008/04/04/bad-words-list/ | |
""" | |
f = open("badwords.txt") | |
lines = f.readlines() | |
lines2 = [] | |
for i in lines: | |
#remove trailing and prepending space |
tt = target_user.created_time | |
tt_int = time.mktime(tt.timetuple()) |
This afternoon I have met a problem for my website, it is not accessible due to an error of psycopg2, which is a module for python to connect with Postgresql database. I would like to document this to public for anyone in future for a referrence.
After the problem occurred, I blamed AWS, that everything was running OK and it just suddenly failed. The fact is that I didn't change anything in between, which is annoying. Or maybe one of the system upgrade suggested by AWS was the reason, I remembered that several packages was installed, but it seemed the problem had not really instantly occurred. But anyhow, the problem has to be solved, after waiting for serveral hours, I started to debug it. The problem states that:
ImproperlyConfigured: Error loading psycopg2 module: No module named psycopg2
which apprently means that psycopg2
is not found by my web server.
in south migration, if add a new column of foreign key constraint, only one line is fine. However, if changing from one existing field which is not a foreign key type, i.e. only a integer type, then should add a line of code
db.create_index
after db.alter_column
though create_index is only for speed consideration.
This is for add a new field of fk constraint: