forked from pycontw/pycon.tw
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 57db211
Showing
94 changed files
with
21,739 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Packaging files: | ||
*.egg* | ||
|
||
# Sphinx docs: | ||
build | ||
|
||
# SQLite3 database files: | ||
*.db | ||
*.sqlite3 | ||
*.sqlite | ||
|
||
# Logs: | ||
*.log | ||
|
||
# Environment variables | ||
local.env | ||
|
||
# Django stuff: | ||
*.mo | ||
*.pot | ||
*.log | ||
venv/ | ||
assets/ | ||
local.db | ||
|
||
# Eclipse | ||
.project | ||
.pydevproject | ||
.settings | ||
|
||
# Linux Editors | ||
*~ | ||
\#*\# | ||
/.emacs.desktop | ||
/.emacs.desktop.lock | ||
.elc | ||
auto-save-list | ||
tramp | ||
.\#* | ||
*.swp | ||
*.swo | ||
|
||
# Rope | ||
.ropeproject | ||
|
||
# Mac | ||
.DS_Store | ||
._* | ||
|
||
# Windows | ||
Thumbs.db | ||
Desktop.ini | ||
|
||
# PyCharm | ||
*.iml | ||
.idea/ | ||
*.ipr | ||
*.iws | ||
|
||
# cache files for sublime text | ||
*.tmlanguage.cache | ||
*.tmPreferences.cache | ||
*.stTheme.cache | ||
*.sublime-workspace | ||
*.sublime-project | ||
|
||
# Cache | ||
CACHE |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Copyright (c) 2014 Arun Ravindran | ||
|
||
Permission is hereby granted, free of charge, to any person | ||
obtaining a copy of this software and associated documentation | ||
files (the "Software"), to deal in the Software without | ||
restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following | ||
conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# PyCon TW 2016 | ||
|
||
This repository serves the website of PyCon TW 2016. This project is open source and the license can be found in LICENSE. | ||
|
||
## Getting Started | ||
|
||
### Requirements | ||
|
||
- Git 1.8+ | ||
- Python 2.7+ | ||
|
||
### Setting up virtualenv | ||
|
||
At first, you should make sure you have [virtualenv](http:https://www.virtualenv.org/) installed. | ||
|
||
then, create your virtualenv: | ||
|
||
virtualenv venv | ||
|
||
Second, you need to enable the virtualenv by | ||
|
||
source venv/bin/activate | ||
|
||
Install all dependencies: | ||
|
||
pip install -r requirements.txt | ||
|
||
### Setting up local environment variables | ||
|
||
Settings are stored in environment variables via [django-environ](http:https://django-environ.readthedocs.org/en/latest/). The quickiest way to start is to rename `local.sample.env` into `local.env`: | ||
|
||
mv src/pycontw2016/settings/local.sample.env src/pycontw2016/settings/local.env | ||
|
||
Then edit the SECRET_KEY in local.env file, replace `{{ secret_key }}` into any [Django Secret Key](http:https://www.miniwebtool.com/django-secret-key-generator/), for example: | ||
|
||
SECRET_KEY=q)uv=&tt2x3enyf7d9)x#!%g_5%p^ozws$k&o(a(u!@%&$t&8a | ||
|
||
### Run web server | ||
|
||
After that, just cd to **src** folder: | ||
|
||
cd src | ||
|
||
And run migrate and http server: | ||
|
||
python manage.py migrate | ||
python manage.py runserver | ||
|
||
## How to contribute | ||
|
||
Follow the [Github Flow](https://guides.github.com/introduction/flow/), please **DON'T push the commits into master directly**, always create branch by the feature you want to update. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
* `django.log`: Contains logs by Django framework like executed SQL statements | ||
* `project.log`: Contains logs from the `project` logger. For example: | ||
|
||
# At the top of your file/module | ||
import logging | ||
logger = logging.getLogger("project") | ||
|
||
# Anywhere else in the file | ||
logger.info('Started processing foo') |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-r requirements/local.txt |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Django | ||
# https://www.djangoproject.com/ | ||
Django==1.8.6 | ||
|
||
# Django-environ allows you to utilize 12factor inspired environment variables | ||
# to configure your Django application. | ||
# http:https://django-environ.readthedocs.org | ||
django-environ==0.4.0 | ||
|
||
# Reusable mixins for Django | ||
# http:https://django-braces.readthedocs.org/en/latest/index.html | ||
django-braces==1.8.1 | ||
|
||
# Better python shell. | ||
# http:https://ipython.org/ | ||
ipython==4.0.0 | ||
|
||
# A collection of custom extensions for the Django Framework | ||
# http:https://django-extensions.readthedocs.org/en/latest/ | ||
django-extensions==1.5.9 | ||
|
||
# Compresses linked and inline JavaScript or CSS into a single cached file. | ||
# https://django-compressor.readthedocs.org/en/latest/ | ||
django-compressor==1.5 | ||
|
||
# A django-compressor filter to compile Sass files using libsass. | ||
# https://github.com/torchbox/django-libsass | ||
django-libsass | ||
|
||
# Faker is a Python package that generates fake data for you. | ||
# http:https://www.joke2k.net/faker/ | ||
fake-factory==0.5.3 | ||
|
||
# Fabric is a Python library and command-line tool for streamlining the use of | ||
# SSH for application deployment or systems administration tasks. | ||
# http:https://www.fabfile.org/ | ||
Fabric==1.10.2 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-r base.txt | ||
# A configurable set of panels that display various debug information about the current | ||
# request/response. | ||
# http:https://django-debug-toolbar.readthedocs.org/ | ||
django-debug-toolbar==1.4 | ||
|
||
# The Python WSGI Utility Library | ||
# http:https://werkzeug.pocoo.org/ | ||
Werkzeug==0.10.4 | ||
|
||
# Code coverage measurement for Python | ||
# https://coverage.readthedocs.org/en/coverage-4.0.2/ | ||
coverage==4.0.2 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
-r base.txt | ||
# Psycopg is the most popular PostgreSQL database adapter for the Python | ||
# programming language. | ||
# http:https://pythonhosted.org/psycopg2/ | ||
psycopg2==2.6.1 | ||
|
||
# Gunicorn 'Green Unicorn' is a Python WSGI HTTP Server for UNIX. | ||
# http:https://gunicorn.org/ | ||
gunicorn==19.3.0 | ||
|
||
# django-redis is a BSD Licensed, full featured Redis cache/session backend for Django. | ||
# http:https://niwinz.github.io/django-redis/latest/ | ||
django-redis==4.3.0 | ||
|
||
# huey, a little task queue | ||
# http:https://huey.readthedocs.org/en/latest/index.html | ||
huey==0.4.9 | ||
|
||
# Redis client for Python | ||
# https://redis-py.readthedocs.org/en/latest/ | ||
redis==2.10.5 | ||
|
||
# Sentry client for Python | ||
# https://raven.readthedocs.org/en/latest/ | ||
raven==5.8.1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env python | ||
import os | ||
import sys | ||
|
||
if __name__ == "__main__": | ||
# CHANGED manage.py will use development settings by | ||
# default. Change the DJANGO_SETTINGS_MODULE environment variable | ||
# for using the environment specific settings file. | ||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pycontw2016.settings.local") | ||
|
||
from django.core.management import execute_from_command_line | ||
|
||
execute_from_command_line(sys.argv) |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Support new str.format syntax in log messages | ||
# | ||
# Based on http:https://stackoverflow.com/a/25433007 and | ||
# http:https://stackoverflow.com/a/26003573 and logging cookbook | ||
# https://docs.python.org/3/howto/logging-cookbook.html#use-of-alternative-formatting-styles | ||
# | ||
# It's worth noting that this implementation has problems if key words | ||
# used for brace substitution include level, msg, args, exc_info, | ||
# extra or stack_info. These are argument names used by the log method | ||
# of Logger. If you need to one of these names then modify process to | ||
# exclude these names or just remove log_kwargs from the _log call. On | ||
# a further note, this implementation also silently ignores misspelled | ||
# keywords meant for the Logger (eg. ectra). | ||
# | ||
|
||
|
||
import logging | ||
|
||
|
||
class NewStyleLogMessage(object): | ||
def __init__(self, message, *args, **kwargs): | ||
self.message = message | ||
self.args = args | ||
self.kwargs = kwargs | ||
|
||
def __str__(self): | ||
args = (i() if callable(i) else i for i in self.args) | ||
kwargs = dict((k, v() if callable(v) else v) | ||
for k, v in self.kwargs.items()) | ||
|
||
return self.message.format(*args, **kwargs) | ||
|
||
N = NewStyleLogMessage | ||
|
||
|
||
class StyleAdapter(logging.LoggerAdapter): | ||
def __init__(self, logger, extra=None): | ||
super(StyleAdapter, self).__init__(logger, extra or {}) | ||
|
||
def log(self, level, msg, *args, **kwargs): | ||
if self.isEnabledFor(level): | ||
msg, log_kwargs = self.process(msg, kwargs) | ||
self.logger._log(level, N(msg, *args, **kwargs), (), | ||
**log_kwargs) | ||
|
||
|
||
logger = StyleAdapter(logging.getLogger("project")) | ||
# Emits "Lazily formatted log entry: 123 foo" in log | ||
# logger.debug('Lazily formatted entry: {0} {keyword}', 123, keyword='foo') |
Empty file.
Oops, something went wrong.