This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="http://americancensorship.org/js"></script> | |
<!-- for long page issues --> | |
<style type="text/css"> | |
#signupmodal-overlay { | |
height: 10000% !important; | |
} | |
div#signupmodal-lightbox { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#assume that task upload already exsists | |
>>> task = upload_to(note, **kwargs): | |
>>> print task.state | |
'PENDING' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# if you are having problem with your 500 pages not rendering properly. | |
from django.conf.urls.defaults import * | |
#bad python practice but makes this easier | |
handler500 = 'webcomic.views.server_error' | |
# in views! | |
def server_error(request): | |
return render(request, '500.html') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
» echo $PATH | |
/usr/local/lib:/home/myusuf3/Node/node/bin:/home/myusuf3/android_sdk/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from haystack.query import SearchQuerySet | |
class MyResource(Resource): | |
def build_filters(self, filters=None): | |
if filters is None: | |
filters = {} | |
orm_filters = super(MyResource, self).build_filters(filters) | |
if "q" in filters: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# to enable new site. | |
sudo a2ensite brodidyouhear.com | |
# reload apache | |
sudo /etc/init.d/apache2 reload |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# i would suggest naming the file that this is contained in after the website. | |
# this will respond to everything on port 80 regardless of the site. | |
<VirtualHost *:80> | |
# this will limit it to requests coming to brodidyouhear.com | |
ServerName brodidyouhear.com | |
# apps directory | |
DocumentRoot /srv/www/brodidyouhear.com/brodidyouhear | |
<Directory /srv/www/brodidyouhear.com/brodidyouhear> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
# this line is added so python is aware of the application | |
# this is absolute path to the app. | |
sys.path.append('/srv/www/brodidyouhear.com/brodidyouhear') | |
# this is simply a check to see if the site is in syspath as well this is one directory up from application | |
path = '/srv/www/brodidyouhear.com' | |
if path not in sys.path: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First you will need to install python drivers for mysql | |
sudo apt-get install python-mysqldb | |
# Now go to your settings.py, enter the credentials you setup during the database creation process of the tutorial | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. | |
'NAME': 'testdb',# Or path to database file if using sqlite3. | |
'USER': 'testuser', # Not used with sqlite3. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# connect as root to the MySQL server | |
# all this is saying connect as user 'root' with password i am going to provide. | |
# you will be prompted for password after you press enter. | |
mysql -u root -p | |
# Once you are connected you will be presented with the following prompt | |
mysql> | |
# if you want to learn type in | |
mysql> /h |