Skip to content

Instantly share code, notes, and snippets.

@stvbdn
stvbdn / README.md
Last active August 29, 2015 14:14 — forked from zenorocha/README.md

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Server Info

@stvbdn
stvbdn / AJAX - Django & jQuery
Created July 18, 2013 22:41
AJAX - Django & jQuery
Here's a shitty example of using AJAX in Django. Serialize your form before you pass it through the data variable.
<script type="text/javascript">
$('#form-delete').on("submit", function(e) {
e.preventDefault()
// Use AJAX to delete the comment.
comment = $(this).attr('data-comment');
$.ajax({
type: 'POST',
url: $(this).attr('action'),
@stvbdn
stvbdn / Recreate virtualenv with new python
Created April 29, 2013 22:03
Recreate virtualenv with new python
virtualenv ~/virtualenvs/tix/ -p /usr/bin/python2.7
@stvbdn
stvbdn / DAIR server setup
Created April 18, 2013 22:01
DAIR server setup
1. Create new SSH key in Access & Security. This will download a .pem file for you.
2. Launch the instance with the follow:
image:
Ubuntu 12.04
service groups:
default
web-server
3. Associate floating ip.
@stvbdn
stvbdn / CSR generation for SSL
Last active December 16, 2015 08:29
CSR generation for SSL
# Generate CSR
openssl req -nodes -newkey rsa:2048 -keyout websiteurl.com.key -out websiteurl.com.csr
# Fill this in
Country Name (2 letter code) [AU]:CA
State or Province Name (full name) [Some-State]:Alberta
Locality Name (eg, city) []:Edmonton
Organization Name (eg, company) [Internet Widgits Pty Ltd]:CompanyName
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:websiteurl.com
@stvbdn
stvbdn / 504 Timeout Error [Django]
Created March 13, 2013 17:35
504 Timeout Error [Django]
If you are doing a process that takes a long time and get a 504 timeout error. It may be because your nginx isnt configured to handle the long load time.
add: uwsgi_read_timeout 900;
to the nginx.conf file and it should work.
@stvbdn
stvbdn / gettext install on Mac
Last active December 11, 2015 14:09
gettext install on Mac
> brew install gettext
> brew link gettext
@stvbdn
stvbdn / Django Haystack Solr Setup
Last active March 28, 2019 11:54
Django + Haystack + Solr Installation/Setup
### Solr Install ###
Install pysolr and django-haystack and set up django-haystack. Setup for haystack is pretty straight forward:
https://django-haystack.readthedocs.org/en/v1.2.7/tutorial.html
Make sure you follow the haystack instructions for the correct version of haystack that you installed,
as some of the setting variables are different depending on the version.
# SSH into the server that you want to install Solr on
@stvbdn
stvbdn / VirtualEnv with different python version
Last active March 28, 2019 11:53
VirtualEnv with different python version
# Make VirtualEnv Command:
mkvirtualenv NAME_OF_VIRUTALENV -p LOCATION_OF_PYTHON_VERSION --no-site-packages
# Example:
mkvirtualenv testenv -p /usr/local/bin/python2.7 --no-site-packages