https://certbot.eff.org/#ubuntutrusty-other
mkdir -p /etc/letsencrypt/configs
- Create the file:
/etc/letsencrypt/configs/domain.com.conf
mkdir -p /var/www/letsencrypt/
https://certbot.eff.org/#ubuntutrusty-other
mkdir -p /etc/letsencrypt/configs
/etc/letsencrypt/configs/domain.com.conf
mkdir -p /var/www/letsencrypt/
from random import choice | |
from string import ascii_lowercase, digits | |
from django.contrib.auth.models import User | |
def generate_random_username(length=16, chars=ascii_lowercase+digits, split=4, delimiter='-'): | |
username = ''.join([choice(chars) for i in xrange(length)]) | |
if split: | |
username = delimiter.join([username[start:start+split] for start in range(0, len(username), split)]) |
require 'date' | |
module Nordea | |
module NDA | |
class Record | |
def self.parse(str) | |
self.new(str).normalized | |
end | |
def initialize(str) |
====================================== | |
Setting up Nginx, uWSGI and Python3 | |
====================================== | |
First off, I'm traditionally a PHP developer, but am looking at moving across to Python. I really struggled to find decent documentation on how to get a server up and running for deploying Python web applications from the point of view of someone coming from PHP. The main problems I came across with documentation were: | |
1) Only showed you how to run the server for a single web application. | |
2) Only showed you how to configure the app, not the server it was running on. | |
My preferred workflow for development is by setting up a new VM in VMware Fusion and then forwarding through all requests to that VM via /etc/hosts. This might not be the optimal way to get things up and running, but it works for me. |
#!/usr/bin/env python | |
"""A noddy fake smtp server.""" | |
import smtpd | |
import asyncore | |
class FakeSMTPServer(smtpd.SMTPServer): | |
"""A Fake smtp server""" | |
def __init__(*args, **kwargs): |
from fabric.api import local, run, env, put | |
import os, time | |
# remote ssh credentials | |
env.hosts = ['10.1.1.25'] | |
env.user = 'deploy' | |
env.password = 'XXXXXXXX' #ssh password for user | |
# or, specify path to server public key here: | |
# env.key_filename = '' |
server { | |
listen 80; | |
server_name blog; | |
server_name blog.example.com; | |
root /var/www/blog; | |
location /static/ { | |
alias /var/www/blog/static/; | |
expires 30d; | |
access_log off; |
[uwsgi] | |
# Variables | |
base = /var/www/blog | |
app = simple | |
# Generic Config | |
plugins = http,python | |
home = %(base)/venv | |
pythonpath = %(base) | |
socket = /var/www/run/%n.sock | |
module = %(app) |