This guide is a walk-through on how to setup Ubuntu Server for hosting Django websites. The Django stack that will be used in this guide is Ubuntu, Nginx, Gunicorn and Postgres. I needed an example site for this guide you can use Django Base Site which is available on Github. For more useful information on Ubuntu server installs, please see the documentation here: https://help.ubuntu.com/12.10/serverguide/
This file contains 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
<?xml version="1.0" encoding="utf-8"?> | |
<!--This file was autogenerated by the #Develop highlighting editor.--> | |
<!--VibrantInk inspired syntax highligthing for C# in #Develop.--> | |
<SyntaxDefinition name="C#" extensions=".cs"> | |
<Environment> | |
<Custom name="TypeReference" bold="false" italic="false" color="Pink" /> | |
<Custom name="UnknownEntity" bold="false" italic="false" color="Yellow" /> | |
<Default bold="false" italic="false" color="White" bgcolor="Black" /> | |
<Selection bold="false" italic="false" color="White" bgcolor="#6897BB" /> | |
<VRuler bold="false" italic="false" color="Pink" bgcolor="#E3E3E3" /> |
This file contains 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
#DapperTest.py - Quick And dirty example of IronPython using Dapper.NET (w/MySql backend and stored procedures) | |
import System | |
import clr | |
#clr.AddReferenceByPartialName("System.Core") | |
clr.AddReferenceByPartialName("System.Data") | |
from System.Collections import IDictionary | |
from System.Collections.Generic import IDictionary, IList | |
from System.Data import IDbConnection, IDbCommand, CommandType |
This file contains 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, clr | |
clr.AddReferenceToFile("MonoGame.Framework.dll") | |
clr.AddReferenceToFile("OpenTK.dll") | |
from Microsoft.Xna.Framework import * | |
from Microsoft.Xna.Framework.Graphics import * | |
class App(Game): | |
def __init__(self): | |
self.graphics = GraphicsDeviceManager(self) |
This file contains 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
//ConfigProxy.cs | |
// Taken modified: | |
// http://tomestephens.com/2011/02/making-ironpython-work-overriding-the-configurationmanager/ | |
// http://tomestephens.com/2011/02/extending-my-ironpython-toolset/ | |
// command line compile: csc /target:library /out:ConfigProxy.dll ConfigProxy.cs | |
// In IronPython, to load up your config file: | |
// import clr | |
// clr.AddReference('System.Core') | |
// clr.AddReference('System.Xml') | |
// clr.AddReference('System.Configuration') |
This file contains 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
[Notepad2] | |
;Notepad2.ini=%WINDIR%\Notepad2-%USERNAME%.ini | |
;Notepad2.ini=%APPDATA%\Notepad2.ini | |
[Settings] | |
SaveSettings=1 | |
SaveRecentFiles=0 | |
SaveFindReplace=0 | |
CloseFind=0 | |
CloseReplace=0 | |
NoFindWrap=0 |
This file contains 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
mkdir heroku | |
cd heroku/ | |
virtualenv --no-site-packages env | |
source env/bin/activate | |
pip install bottle gevent | |
pip freeze > requirements.txt | |
cat >app.py <<EOF | |
import bottle | |
import os |
This file contains 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 logging | |
import time | |
logger = logging.getLogger(__name__) | |
def useful(): | |
logger.debug('Hello from webapplib!') | |
time.sleep(0.01) |
This file contains 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
jQuery.validator.addMethod("dateGreaterThan", function (value, element, params) { | |
if (!/Invalid|NaN/.test(new Date(value))) { | |
return new Date(value) > new Date($(params).val()); | |
} | |
return isNaN(value) && isNaN($(params).val()) | |
|| (Number(value) > Number($(params).val())); | |
}, '<br />Must be greater than {0}.'); | |
jQuery.validator.addMethod('greaterThan', function (value, element, param) { |
This file contains 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
!#/bin/sh | |
# REMOVAL ################################## | |
sudo apt-get --purge remove postgresql | |
sudo apt-get purge postgresql* | |
sudo apt-get --purge remove postgresql postgresql-doc postgresql-common | |
sudo rm -rf /var/lib/postgresql/ | |
sudo rm -rf /var/log/postgresql/ | |
sudo rm -rf /etc/postgresql/ |
OlderNewer