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
# What this command literally does is this: | |
# It iterates through directory in which the command is executed selecting .mp4 files only | |
# It then runs avconv command conversion on them | |
# See the parameters from avconv manual for details. | |
for i in *.mp4; do avconv -i "$i" -c:v h264 -crf 18 -c:a mp3 -r 30 "out-$i.mp4" ; done |
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 django import forms | |
# import models here from django and subclass | |
from django.db import models | |
from django.template.defaultfilters import filesizeformat | |
from django.utils.translation import ugettext_lazy as _ | |
from django.conf import settings | |
class RestrictedFileFieldModel(models.FileField): | |
def __init__(self, *args, **kwargs): | |
self.content_types = kwargs.pop('content_types', None) |
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
# models.py | |
from django.db import models | |
class Recipe(models.Model): | |
title = models.CharField(max_length=255) | |
description = models.TextField() | |
class Ingredient(models.Model): |
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 all, have DEBUG = True in your settings.py | |
Nginx should be installed. After nginx install, restart PC, if not already. | |
Create a new file in /etc/nginx/sites-available/<file_name> | |
Put in this. I called mine noodles | |
/etc/nginx/sites-available/noodles | |
upstream app_server { |
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 django.contrib import admin | |
from django.contrib.flatpages.models import FlatPage | |
# Note: we are renaming the original Admin and Form as we import them! | |
from django.contrib.flatpages.admin import FlatPageAdmin as FlatPageAdminOld | |
from django.contrib.flatpages.admin import FlatpageForm as FlatpageFormOld | |
from django import forms | |
from ckeditor.widgets import CKEditorWidget |
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
upstream app_server { | |
server 127.0.0.1:9000 fail_timeout=0; | |
} | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server ipv6only=on; | |
# root /usr/share/nginx/html; | |
root /home/portfolio; |
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
# This decleared upstream app_server is referenced | |
# below. Its a declare once, use many times kinda thing | |
upstream app_server { | |
server 127.0.0.1:9000 fail_timeout=0; | |
} | |
# server configurations begins | |
server { |
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
# Note: we are renaming the original Admin and Form as we import them! | |
from django.contrib.flatpages.admin import FlatPageAdmin as FlatPageAdminOld | |
from django.contrib.flatpages.admin import FlatpageForm as FlatpageFormOld | |
from django import forms | |
from ckeditor.widgets import CKEditorWidget | |
class FlatpageForm(FlatpageFormOld): | |
content = forms.CharField(widget=CKEditorWidget()) |
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
description "Gunicorn daemon for Django project" | |
start on (local-filesystems and net-device-up IFACE=eth0) | |
stop on runlevel [!12345] | |
# If the process quits unexpectadly trigger a respawn | |
respawn | |
# by default DO has user django | |
setuid django |
OlderNewer