Skip to content

Commit c4bf84b

Browse files
author
Rafi Blecher
committed
Initial commit, with README
0 parents  commit c4bf84b

15 files changed

+1213
-0
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*.pyc
2+
*.pyo
3+
*.db
4+
.DS_Store
5+
.coverage
6+
local_settings.py
7+
/static

.hgignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
syntax: glob
2+
*.pyc
3+
*.pyo
4+
*.db
5+
.DS_Store
6+
.coverage
7+
local_settings.py
8+
9+
syntax: regexp
10+
^static/

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
csesoc-website-v2
2+
=================
3+
4+
Lets remake the csesoc website
5+
6+
## Developer setup for Ubuntu
7+
###Core packages
8+
```
9+
$ sudo apt-get install git pip sqlite3
10+
```
11+
12+
###Setting up virtualenv
13+
This is only necessay if you work on a lot of Python projects. It's mainly to deal with package dependencies. It's not completely necessary, but its a good habit.
14+
```
15+
$ sudo apt-get install virtualenv
16+
$ virtualenv <environment_name>
17+
$ . <environment_name>/bin/activate
18+
```
19+
You'll see in your terminal that it has \<environment_name\> at the start of the line
20+
21+
### Installing packages
22+
Run the following
23+
```
24+
$ git clone [email protected]:csesoc/csesoc-website-v2.git
25+
$ cd csesoc-website-v2
26+
$ pip install -r requirements.txt
27+
```
28+
29+
### Database Setup
30+
The database for the website is stored in soc-website.db so we only need to run syncdb
31+
```
32+
$ python manage.py syncdb
33+
```
34+
35+
### Serving static files
36+
Mezzanine has some issues serving static files. To fix this, run the following
37+
```
38+
$ chmod +x static.sh && static/static.sh
39+
```
40+
41+
### Running the server
42+
To start the server, run
43+
```
44+
$ python manage.py runserver
45+
```
46+
Enjoy!

__init__.py

Whitespace-only changes.

deploy/crontab

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*/5 * * * * %(user)s %(manage)s poll_twitter

deploy/gunicorn.conf.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from __future__ import unicode_literals
2+
import multiprocessing
3+
4+
bind = "127.0.0.1:%(gunicorn_port)s"
5+
workers = multiprocessing.cpu_count() * 2 + 1
6+
loglevel = "error"
7+
proc_name = "%(proj_name)s"

deploy/live_settings.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from __future__ import unicode_literals
2+
3+
SECRET_KEY = "%(secret_key)s"
4+
NEVERCACHE_KEY = "%(nevercache_key)s"
5+
6+
DATABASES = {
7+
"default": {
8+
# Ends with "postgresql_psycopg2", "mysql", "sqlite3" or "oracle".
9+
"ENGINE": "django.db.backends.postgresql_psycopg2",
10+
# DB name or path to database file if using sqlite3.
11+
"NAME": "%(proj_name)s",
12+
# Not used with sqlite3.
13+
"USER": "%(proj_name)s",
14+
# Not used with sqlite3.
15+
"PASSWORD": "%(db_pass)s",
16+
# Set to empty string for localhost. Not used with sqlite3.
17+
"HOST": "127.0.0.1",
18+
# Set to empty string for default. Not used with sqlite3.
19+
"PORT": "",
20+
}
21+
}
22+
23+
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTOCOL", "https")
24+
25+
CACHE_MIDDLEWARE_SECONDS = 60
26+
27+
CACHE_MIDDLEWARE_KEY_PREFIX = "%(proj_name)s"
28+
29+
CACHES = {
30+
"default": {
31+
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
32+
"LOCATION": "127.0.0.1:11211",
33+
}
34+
}
35+
36+
SESSION_ENGINE = "django.contrib.sessions.backends.cache"

deploy/nginx.conf

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
upstream %(proj_name)s {
3+
server 127.0.0.1:%(gunicorn_port)s;
4+
}
5+
6+
server {
7+
listen 80;
8+
listen 443 ssl;
9+
server_name %(live_host)s;
10+
client_max_body_size 10M;
11+
keepalive_timeout 15;
12+
13+
ssl_certificate conf/%(proj_name)s.crt;
14+
ssl_certificate_key conf/%(proj_name)s.key;
15+
ssl_session_cache shared:SSL:10m;
16+
ssl_session_timeout 10m;
17+
ssl_ciphers RC4:HIGH:!aNULL:!MD5;
18+
ssl_prefer_server_ciphers on;
19+
20+
location / {
21+
proxy_redirect off;
22+
proxy_set_header Host $host;
23+
proxy_set_header X-Real-IP $remote_addr;
24+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
25+
proxy_set_header X-Forwarded-Protocol $scheme;
26+
proxy_pass http://%(proj_name)s;
27+
}
28+
29+
location /static/ {
30+
root %(proj_path)s;
31+
access_log off;
32+
log_not_found off;
33+
}
34+
35+
location /robots.txt {
36+
root %(proj_path)s/static;
37+
access_log off;
38+
log_not_found off;
39+
}
40+
41+
location /favicon.ico {
42+
root %(proj_path)s/static/img;
43+
access_log off;
44+
log_not_found off;
45+
}
46+
47+
}

deploy/supervisor.conf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[group:%(proj_name)s]
2+
programs=gunicorn_%(proj_name)s
3+
4+
[program:gunicorn_%(proj_name)s]
5+
command=%(venv_path)s/bin/gunicorn_django -c gunicorn.conf.py -p gunicorn.pid
6+
directory=%(proj_path)s
7+
user=%(user)s
8+
autostart=true
9+
autorestart=true
10+
redirect_stderr=true
11+
environment=LANG="%(locale)s",LC_ALL="%(locale)s",LC_LANG="%(locale)s"

0 commit comments

Comments
 (0)