Skip to content

Commit 6710803

Browse files
committed
Initial commit
0 parents  commit 6710803

18 files changed

+324
-0
lines changed

.gitignore

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# exclude idea files
2+
/.idea
3+
4+
# Directory with static files
5+
staticfiles/
6+
uploads/
7+
staticfiles/*
8+
uploads/*
9+
10+
# Vim plugins
11+
.ropeproject/
12+
13+
# Byte-compiled / optimized / DLL files
14+
*.py[cod]
15+
16+
__pycache__/
17+
18+
private.key
19+
logs
20+
conf
21+
logs/*
22+
conf/*
23+
24+
temp*.py
25+
26+
# Vagrant service directory
27+
.vagrant
28+
ipfs_files

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Steepshot.io
2+
3+
Steepshot.io is a landing website of Steepshot platform.

conf_templates/postactivate

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
# This hook is run after this virtualenv is activated.
3+
4+
export DJANGO_SETTINGS_MODULE=%(SETTINGS_MODULE)s
5+
export DATABASE_URL=%(DATABASE_URL)s
6+
export DJANGO_DEBUG=False
7+
export DJANGO_LOCAL=False

requirements.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
appdirs==1.4.3
2+
celery==3.1.23
3+
dj-database-url==0.3.0
4+
Django==1.11.1
5+
django-redis==4.6.0
6+
packaging==16.8
7+
psycopg2==2.7.1
8+
pyparsing==2.2.0
9+
pytz==2017.2
10+
redis==2.10.5
11+
six==1.10.0

steepshot_io/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from __future__ import absolute_import
2+
3+
from .celeryapp import app as celery_app

steepshot_io/celeryapp.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from __future__ import absolute_import
2+
3+
import os
4+
5+
from celery import Celery
6+
7+
from django.conf import settings
8+
9+
# Indicate Celery to use the default Django settings module
10+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'steepshot_io.config.prod_settings')
11+
12+
app = Celery('steepshot_io')
13+
app.config_from_object('django.conf:settings')
14+
15+
# This line will tell Celery to autodiscover all your tasks.py that are in your app folders
16+
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)

steepshot_io/config/__init__.py

Whitespace-only changes.

steepshot_io/config/prod_settings.py

+180
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
"""
2+
Django settings for steepshot_io project.
3+
4+
Generated by 'django-admin startproject' using Django 1.11.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/1.11/topics/settings/
8+
9+
For the full list of settings and their values, see
10+
https://docs.djangoproject.com/en/1.11/ref/settings/
11+
"""
12+
13+
import os
14+
import dj_database_url
15+
16+
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
17+
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
18+
19+
20+
# Quick-start development settings - unsuitable for production
21+
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
22+
23+
# SECURITY WARNING: keep the secret key used in production secret!
24+
SECRET_KEY = os.getenv('SECRET_KEY')
25+
26+
# SECURITY WARNING: don't run with debug turned on in production!
27+
if os.getenv('DJANGO_DEBUG'):
28+
DEBUG = os.getenv('DJANGO_DEBUG') == 'True'
29+
else:
30+
DEBUG = False
31+
32+
if os.getenv('DJANGO_LOCAL'):
33+
LOCAL = os.getenv('DJANGO_LOCAL') == 'True'
34+
else:
35+
LOCAL = False
36+
37+
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
38+
39+
if DEBUG:
40+
ALLOWED_HOSTS = ['*']
41+
else:
42+
ALLOWED_HOSTS = []
43+
44+
PROJECT_NAME = 'steepshot_io'
45+
46+
STEEM_NODE = 'wss://steemd.steemit.com'
47+
GOLOS_NODE = 'wss://ws.golos.io'
48+
49+
IS_STEEM_CHAIN = True
50+
IS_GOLOS_CHAIN = not IS_STEEM_CHAIN
51+
52+
if IS_STEEM_CHAIN:
53+
CURRENT_NODE = STEEM_NODE
54+
elif IS_GOLOS_CHAIN:
55+
CURRENT_NODE = GOLOS_NODE
56+
else:
57+
CURRENT_NODE = u''
58+
59+
# Application definition
60+
61+
INSTALLED_APPS = [
62+
'django.contrib.admin',
63+
'django.contrib.auth',
64+
'django.contrib.contenttypes',
65+
'django.contrib.sessions',
66+
'django.contrib.messages',
67+
'django.contrib.staticfiles',
68+
69+
'steepshot_io.core',
70+
]
71+
72+
MIDDLEWARE = [
73+
'django.middleware.security.SecurityMiddleware',
74+
'django.contrib.sessions.middleware.SessionMiddleware',
75+
'django.middleware.common.CommonMiddleware',
76+
'django.middleware.csrf.CsrfViewMiddleware',
77+
'django.contrib.auth.middleware.AuthenticationMiddleware',
78+
'django.contrib.messages.middleware.MessageMiddleware',
79+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
80+
]
81+
82+
ROOT_URLCONF = 'steepshot_io.config.urls'
83+
84+
TEMPLATES = [
85+
{
86+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
87+
'DIRS': [
88+
os.path.join(PROJECT_PATH, 'templates'),
89+
],
90+
'APP_DIRS': True,
91+
'OPTIONS': {
92+
'debug': DEBUG,
93+
'context_processors': [
94+
'django.template.context_processors.debug',
95+
'django.template.context_processors.i18n',
96+
'django.template.context_processors.media',
97+
'django.template.context_processors.static',
98+
'django.template.context_processors.request',
99+
'django.template.context_processors.tz',
100+
'django.template.context_processors.request',
101+
'django.contrib.auth.context_processors.auth',
102+
'django.contrib.messages.context_processors.messages',
103+
],
104+
},
105+
},
106+
]
107+
108+
WSGI_APPLICATION = 'steepshot_io.config.wsgi.application'
109+
110+
111+
# Database
112+
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
113+
114+
DATABASES = {
115+
'default': dj_database_url.config()
116+
}
117+
DATABASES['default']['ATOMIC_REQUESTS'] = True
118+
119+
120+
# Password validation
121+
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
122+
123+
AUTH_PASSWORD_VALIDATORS = [
124+
{
125+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
126+
},
127+
{
128+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
129+
},
130+
{
131+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
132+
},
133+
{
134+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
135+
},
136+
]
137+
138+
USE_REDIS = True
139+
if USE_REDIS:
140+
BROKER_URL = 'redis://localhost:6379/0'
141+
CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
142+
else:
143+
BROKER_URL = 'django://'
144+
# Safe serializer settings
145+
CELERY_ACCEPT_CONTENT = ['json']
146+
CELERY_TASK_SERIALIZER = 'json'
147+
CELERY_RESULT_SERIALIZER = 'json'
148+
149+
# Internationalization
150+
# https://docs.djangoproject.com/en/1.11/topics/i18n/
151+
152+
LANGUAGE_CODE = 'en-us'
153+
154+
TIME_ZONE = 'UTC'
155+
156+
USE_I18N = True
157+
158+
USE_L10N = True
159+
160+
USE_TZ = True
161+
162+
INTERNAL_IPS = (
163+
'0.0.0.0',
164+
'127.0.0.1',
165+
)
166+
167+
MEDIA_ROOT = os.path.join(PROJECT_PATH, 'uploads')
168+
MEDIA_URL = '/uploads/'
169+
170+
# Static files (CSS, JavaScript, Images)
171+
# https://docs.djangoproject.com/en/1.11/howto/static-files/
172+
173+
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
174+
STATIC_URL = '/static/'
175+
176+
STATICFILES_DIRS = (
177+
os.path.join(PROJECT_PATH, 'static'),
178+
)
179+
180+
ADMIN_URL = r'^djadmin/'

steepshot_io/config/urls.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""steepshot_io URL Configuration
2+
3+
The `urlpatterns` list routes URLs to views. For more information please see:
4+
https://docs.djangoproject.com/en/1.11/topics/http/urls/
5+
Examples:
6+
Function views
7+
1. Add an import: from my_app import views
8+
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
9+
Class-based views
10+
1. Add an import: from other_app.views import Home
11+
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
12+
Including another URLconf
13+
1. Import the include() function: from django.conf.urls import url, include
14+
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
15+
"""
16+
from django.conf import settings
17+
from django.conf.urls import url
18+
from django.contrib import admin
19+
20+
urlpatterns = [
21+
url(settings.ADMIN_URL, admin.site.urls),
22+
]

steepshot_io/config/wsgi.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
WSGI config for steepshot_io project.
3+
4+
It exposes the WSGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.wsgi import get_wsgi_application
13+
14+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "steepshot_io.config.prod_settings")
15+
16+
application = get_wsgi_application()

steepshot_io/core/__init__.py

Whitespace-only changes.

steepshot_io/core/admin.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from django.contrib import admin

steepshot_io/core/apps.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class CoreConfig(AppConfig):
5+
name = 'core'

steepshot_io/core/models.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from django.db import models

steepshot_io/core/tasks.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import datetime
2+
3+
from celery import task

steepshot_io/core/tests.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.test import TestCase
2+
3+
# Create your tests here.

steepshot_io/core/views.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.shortcuts import render
2+
3+
# Create your views here.

steepshot_io/manage.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python
2+
import os
3+
import sys
4+
5+
if __name__ == "__main__":
6+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "steepshot_io.config.prod_settings")
7+
try:
8+
from django.core.management import execute_from_command_line
9+
except ImportError:
10+
# The above import may fail for some other reason. Ensure that the
11+
# issue is really that Django is missing to avoid masking other
12+
# exceptions on Python 2.
13+
try:
14+
import django
15+
except ImportError:
16+
raise ImportError(
17+
"Couldn't import Django. Are you sure it's installed and "
18+
"available on your PYTHONPATH environment variable? Did you "
19+
"forget to activate a virtual environment?"
20+
)
21+
raise
22+
execute_from_command_line(sys.argv)

0 commit comments

Comments
 (0)