This document has now been incorporated into the uWSGI documentation:
http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html
Steps with explanations to set up a server using:
| from django.db import models | |
| class Person(models.Model): | |
| name = models.CharField(max_length=200) | |
| groups = models.ManyToManyField('Group', through='GroupMember', related_name='people') | |
| class Meta: | |
| ordering = ['name'] | |
| def __unicode__(self): |
We have moved: https://github.com/magnetikonline/linuxmicrosoftievirtualmachines
Due to the popularity of this Gist, and the work in keeping it updated via a Gist, all future updates will take place at the above location. Thanks!
| if (isset($_SERVER['PANTHEON_ENVIRONMENT'])) { | |
| switch ($_SERVER['PANTHEON_ENVIRONMENT']) { | |
| case 'test': | |
| $base_url = 'http://test-example.gotpantheon.com'; // NO trailing slash! | |
| break; | |
| case 'dev': | |
| $base_url = 'http://dev-example.gotpantheon.com'; // NO trailing slash! | |
| break; | |
| case 'live': | |
| $base_url = 'http://www.example.com'; // NO trailing slash! |
Hi there!
The docker cheat sheet has moved to a Github project under https://github.com/wsargent/docker-cheat-sheet.
Please click on the link above to go to the cheat sheet.
| # -*- coding: utf-8 -*- | |
| from django.core.management.base import BaseCommand, CommandError | |
| from django.db.models.loading import get_model | |
| class Command(BaseCommand): | |
| help = "Reindex a given model." | |
| args = 'app.Model' | |
| def handle(self, *args, **options): | |
| if not args: |
| # Ask for the user password | |
| # Script only works if sudo caches the password for a few minutes | |
| sudo true | |
| # Install kernel extra's to enable docker aufs support | |
| # sudo apt-get -y install linux-image-extra-$(uname -r) | |
| # Add Docker PPA and install latest version | |
| # sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | |
| # sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list" |
| """Crop a polygonal selection from an image.""" | |
| import numpy as np | |
| from PIL import Image | |
| from shapely.geometry import Point | |
| from shapely.geometry import Polygon | |
| im = Image.open('bird.jpg').convert('RGBA') | |
| pixels = np.array(im) | |
| im_copy = np.array(im) |
| from io import BytesIO | |
| import requests | |
| from django.core.files.images import ImageFile | |
| from wagtail.wagtailimages.models import Image | |
| # event is a model object, substitute your model | |
| # filename and title are up to you | |
| # in my model, event.event_image is a ForeignKey to wagtailimages.Image | |
| response = requests.get(url) |