master
Nick Sergeant 2012-09-21 16:53:32 -04:00
commit 2f536861e8
11 changed files with 107 additions and 26 deletions

19
LICENSE Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2012 Nick Sergeant
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.

16
README.md Normal file
View File

@ -0,0 +1,16 @@
# Snipt
This is the codebase for the website, [Snipt.net](https://snipt.net/).
It's a relatively well-kept Django app, so you shouldn't have too many problems
getting a local copy running.
# Running the Django app
1. Clone the repo.
2. Setup a virtualenv.
3. `pip install -r requirements`
4. Copy local_settings-template.py to local_settings.py and edit the settings.
5. Run it!
Any problems / questions / bugs, [create an issue](https://github.com/nicksergeant/snipt/issues). Thanks! :)

6
fabfile.py vendored
View File

@ -1,4 +1,4 @@
from fabric.api import cd, local, env, run
from fabric.api import cd, local, env, run, sudo
from boto.s3.connection import S3Connection
from boto.s3.key import Key
@ -77,12 +77,12 @@ def re():
_display_message('Kill gunicorn process')
################
run('./gk')
sudo('supervisorctl stop snipt')
_display_message('Restart gunicorn process')
################
run('/home/nick/.virtualenvs/snipt/bin/python /home/nick/.virtualenvs/snipt/bin/gunicorn -c gunicorn.conf.py debug_wsgi:application')
sudo('supervisorctl start snipt')
def db_backup():

12
gunicorn.conf.server.py Normal file
View File

@ -0,0 +1,12 @@
bind = "unix:/tmp/gunicorn.snipt.sock"
daemon = False # Whether work in the background
debug = False # Some extra logging
logfile = ".gunicorn.log" # Name of the log file
loglevel = "info" # The level at which to log
pidfile = ".gunicorn.pid" # Path to a PID file
workers = 9 # Number of workers to initialize
umask = 0 # Umask to set when daemonizing
user = None # Change process owner to user
group = None # Change process group to group
proc_name = "gunicorn-snipt" # Change the process name
tmp_upload_dir = None # Set path used to store temporary uploads

View File

@ -0,0 +1,35 @@
ADMINS = (
('Name', 'name@domain.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'snipt',
'USER': '',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '',
}
}
SECRET_KEY = ''
DEFAULT_FROM_EMAIL = 'support@snipt.net'
SERVER_EMAIL = 'support@snipt.net'
EMAIL_BACKEND = 'postmark.django_backend.EmailBackend'
POSTMARK_API_KEY = ''
VIRTUALENV_PATH = ''
AMAZON_API_KEY = ''
AMAZON_API_SECRET = ''
STRIPE_API_KEY = ''
ENV_HOST = 'user@domain.com:22'
BUGSNAG = {
"api_key": "",
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1060,7 +1060,7 @@ article.snipt {
padding-bottom: 20px;
ul.attrs {
margin: 15px 0 0 15px;
margin: 14px 0 0 15px;
li {
background: transparent url('/static/images/calendar-icon.png') top left no-repeat;
@ -1112,9 +1112,9 @@ article.snipt {
}
&.tweet {
background: none;
float: right;
margin: -1px 130px 0 0;
margin: -1px 0 0 0;
padding: 0;
vertical-align: -6px;
a {
color: transparent;
@ -1289,7 +1289,7 @@ div#disqus_thread {
width: 825px;
#dsq-content {
margin-top: -38px;
margin-top: -44px;
#dsq-global-toolbar {
margin-bottom: 18px;
@ -1466,13 +1466,6 @@ body.detail {
}
}
}
footer {
ul.attrs {
li.tweet {
margin-right: 258px;
}
}
}
div.rochester-made {
width: 840px;
}
@ -1778,6 +1771,7 @@ body.api {
h5 {
margin-bottom: 5px;
margin-top: 0;
}
ul {
margin: 0;

View File

@ -108,6 +108,7 @@ MIDDLEWARE_CLASSES = (
'django.contrib.messages.middleware.MessageMiddleware',
'pagination.middleware.PaginationMiddleware',
'blogs.middleware.BlogMiddleware',
'bugsnag.django.middleware.BugsnagMiddleware',
)
ROOT_URLCONF = 'snipt.urls'
@ -162,11 +163,11 @@ LOGGING = {
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
#'django.request': {
#'handlers': ['mail_admins'],
#'level': 'ERROR',
#'propagate': True,
#},
}
}
@ -222,6 +223,12 @@ else:
# API
TASTYPIE_CANNED_ERROR = "There was an error with your request. The site developers have a record of this error, please email api@snipt.net and we'll help you out."
# Bugsnag
BUGSNAG = {
"api_key": "",
"project_root": PROJECT_PATH,
}
# Extensions
if DEBUG:
INSTALLED_APPS += ('django_extensions',)

View File

@ -110,9 +110,7 @@
{% block author %}
<li class="author">
<span class="avatar" style="background-image: url('https://secure.gravatar.com/avatar/{{ snipt.user.email|md5 }}?s=15&amp;d=https%3A%2F%2Fsnipt.net%2Fstatic%2Fimages%2Fauthor-icon.png');"></span>
<a href="{{ snipt.user.get_absolute_url }}">
{{ snipt.user.username }}
</a>
<a href="{{ snipt.user.get_absolute_url }}">{{ snipt.user.username }}</a>
{% if snipt.user.profile.is_pro %}
<span class="pro"><a href="/pro/">Pro</a></span>
{% endif %}
@ -124,7 +122,7 @@
<li class="created" title="{{ snipt.created|date:"Y-m-d\TH:i:s" }}">{{ snipt.created|naturaltime }}</li>
{% endif %}
<li class="comments"><a href="{{ snipt.get_full_absolute_url }}#disqus_thread" data-disqus-identifier="{{ snipt.pk }}"></a></li>
{% if detail %}
{% if detail and snipt.public %}
<li class="tweet">
<a href="https://twitter.com/share" class="twitter-share-button" data-dnt="true" data-count="none" data-url="{{ snipt.get_full_absolute_url }}" data-text="&ldquo;{{ snipt.title }}&rdquo; on @Snipt">Tweet</a>
</li>

View File

@ -19,7 +19,7 @@
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/snipt.css?34" />
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/snipt.css?36" />
{% if has_snipts and not detail %}
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ request.path }}?rss{% if not public %}&amp;api_key={{ request.user.api_key.key }}{% endif %}" />