Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
455 commits
Select commit Hold shift + click to select a range
72c3d7a
comment out pdb
constanthatz Mar 10, 2015
2a13d1d
work on profile.html and css
henrykh Mar 10, 2015
71364f0
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
henrykh Mar 10, 2015
5e539a6
add cover thumbnail method to album model
constanthatz Mar 10, 2015
ca1548c
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
constanthatz Mar 10, 2015
c7f50e8
adds normalize.css, routes for app urls
henrykh Mar 10, 2015
7167288
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
henrykh Mar 10, 2015
3803809
first draft library view, images urls, library template. comment pdb.
constanthatz Mar 10, 2015
39a3df4
moves profile.html
henrykh Mar 10, 2015
78c3549
fix merge
henrykh Mar 10, 2015
44029da
login redirect update
henrykh Mar 10, 2015
65346b8
second draft library view, images urls, library template
constanthatz Mar 10, 2015
d610b2d
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
constanthatz Mar 10, 2015
0a8e66a
revert thumbnails to admin page. broken.
constanthatz Mar 10, 2015
8c8dc81
admin fix. broken
constanthatz Mar 10, 2015
91b8438
adds default profile image
henrykh Mar 10, 2015
b3241b9
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
henrykh Mar 10, 2015
4503ed7
admin fix. broken
constanthatz Mar 10, 2015
434e4b1
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
constanthatz Mar 10, 2015
c86a543
add css for library
constanthatz Mar 10, 2015
9a46d7e
add link to library page
henrykh Mar 10, 2015
a5692f0
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
henrykh Mar 10, 2015
e8e0140
css for library grid
constanthatz Mar 10, 2015
247cfe9
initial work on stream view
henrykh Mar 11, 2015
c577a73
first draft lightbox
constanthatz Mar 11, 2015
bcdaf4d
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
constanthatz Mar 11, 2015
5d827af
second draft lightbox
constanthatz Mar 11, 2015
ff9308e
working lightbox
constanthatz Mar 11, 2015
b81f915
working thumbnail for photo admin.
constanthatz Mar 11, 2015
e979ed1
adds stream view
henrykh Mar 11, 2015
ecd758e
working thumbnails for album cover and profile picture in admin.
constanthatz Mar 11, 2015
5b73035
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
constanthatz Mar 11, 2015
a72f3e0
css updates
henrykh Mar 11, 2015
58f695f
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
henrykh Mar 11, 2015
5a23487
fix url to default cover image
constanthatz Mar 11, 2015
2e89c81
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
constanthatz Mar 11, 2015
42c6d57
implement django debug toolbar. pip install requirements
constanthatz Mar 11, 2015
48c289a
remove deprecated css file
constanthatz Mar 12, 2015
0ae89a0
remove deprecated css file
constanthatz Mar 12, 2015
3124e88
photo create, update, and delete views
constanthatz Mar 12, 2015
c439a76
initial work on create album view
henrykh Mar 12, 2015
dd90882
resolves merge conflict
henrykh Mar 12, 2015
bd4603c
working link to delete confirmation in photo update page.
constanthatz Mar 12, 2015
5ded991
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
constanthatz Mar 12, 2015
4b6a1ee
PEP8 code formatting
constanthatz Mar 12, 2015
e4121e3
fix merge conflicts
constanthatz Mar 12, 2015
74885fe
add user authentication to album and photo update views
constanthatz Mar 12, 2015
e679838
albums restricted to user owned albums in photo update view.
constanthatz Mar 12, 2015
6e2da64
broken album form and start of photoformset
constanthatz Mar 12, 2015
b9e9d5c
outline library FormView
constanthatz Mar 12, 2015
6bad762
fix default cover of album lightbox integration
constanthatz Mar 12, 2015
32997d6
second try library listview
constanthatz Mar 12, 2015
075d0f8
revert library
constanthatz Mar 12, 2015
f4aa825
link from library to album photos. link from photo to photo update pa…
constanthatz Mar 12, 2015
b00498c
work on create album
henrykh Mar 12, 2015
a147c7d
fix merge
henrykh Mar 12, 2015
d65bb2a
redirect from saved new album working
henrykh Mar 13, 2015
e0ba8a4
moves success url from model to view
henrykh Mar 13, 2015
9397a55
photo update success redirects to source page
constanthatz Mar 13, 2015
729651c
remove pdb set traces
constanthatz Mar 13, 2015
fab78ad
first pass at loose photos view
constanthatz Mar 13, 2015
d8a9ed6
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
constanthatz Mar 13, 2015
f582f57
add photo view works now
henrykh Mar 13, 2015
f577614
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
henrykh Mar 13, 2015
73ab8a7
working loose photos and all photos pseudo albums in library
constanthatz Mar 13, 2015
960914e
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
constanthatz Mar 13, 2015
3e8b1c1
work on profile edit
henrykh Mar 13, 2015
c584004
resolve merge
henrykh Mar 13, 2015
41e2565
fix forms for admin site
constanthatz Mar 13, 2015
0b82a34
add lightbox to stream, reorder albums in library, fix views
constanthatz Mar 13, 2015
25a4430
reorder library
constanthatz Mar 13, 2015
2b9f66b
Profile updae form without user name and email fields
constanthatz Mar 13, 2015
a5950cf
working on adding inline formset to add album view
henrykh Mar 13, 2015
a668208
add profile edit view with user model fields, first name, last name a…
constanthatz Mar 13, 2015
dcce40c
profile update page updates user info: first name, last name, email.
constanthatz Mar 13, 2015
2dca7a0
work on trying to restrict photos to users in add album
henrykh Mar 13, 2015
a7bdcbc
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
henrykh Mar 13, 2015
ef87eef
follows and blocking fields exclude logged in user profile
constanthatz Mar 13, 2015
4acab9f
image title automtically set as file name if not set by user
constanthatz Mar 13, 2015
5c23368
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
constanthatz Mar 13, 2015
3ae5d73
tests for profile and home for logged in user
constanthatz Mar 13, 2015
33cbcf8
change welcome text for logged in user
constanthatz Mar 13, 2015
ebbab13
change login redirect, titles on stream, library, profile pages. test…
constanthatz Mar 13, 2015
6f1ba5e
users can add their photos to a new album
henrykh Mar 13, 2015
ccc6b98
resolve merge
henrykh Mar 13, 2015
94a99c8
propoerly change login redirect
constanthatz Mar 13, 2015
f644827
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
henrykh Mar 13, 2015
14560f1
updates to profile page
henrykh Mar 14, 2015
820e048
set Photo instance file size with save method overide instead of usin…
constanthatz Mar 14, 2015
e238bf3
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
constanthatz Mar 14, 2015
22cb41c
add tests for home, profile, stream, library, logout links on home pa…
constanthatz Mar 14, 2015
8134e25
remove derpecated files and code related to handlers of file size
constanthatz Mar 14, 2015
53393a8
add tests for home, login, register links on home page for logged out…
constanthatz Mar 14, 2015
e52b358
add test to verify at login page when clicking login
constanthatz Mar 14, 2015
40e665b
add test to verify at registration page when clicking join link
constanthatz Mar 14, 2015
163d15b
test that registration creates user
constanthatz Mar 14, 2015
01150fe
test login redirect on successful login
constanthatz Mar 14, 2015
ccc3b25
test login failure correct response
constanthatz Mar 14, 2015
55358d9
test "this account is inactive" message for regstered but inactive user
constanthatz Mar 14, 2015
bf22429
delete old code
constanthatz Mar 14, 2015
d9ec377
adds photo, album, and follower counts to profile page, css needs work
henrykh Mar 14, 2015
bab69c3
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
henrykh Mar 14, 2015
b9cba50
split registration tests
constanthatz Mar 14, 2015
0130dff
change EmailBackend to filebased
constanthatz Mar 14, 2015
a104951
revert email backend
constanthatz Mar 14, 2015
bec0026
test successful log in after registration
constanthatz Mar 14, 2015
f23bb31
tests complete for first front end assignemnt. segregate tests.
constanthatz Mar 14, 2015
191bf03
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
henrykh Mar 14, 2015
d914dff
minor css updates
henrykh Mar 15, 2015
aff46f9
Delete 2015-01-22_17.22.14_ohsULpd.jpg
constanthatz Mar 15, 2015
162a17f
Delete 2015-01-22_17.30.02_iDfLYid.jpg
constanthatz Mar 15, 2015
3a219ef
Delete 2015-01-25_14.26.53.jpg
constanthatz Mar 15, 2015
aa933e4
update gitignore
constanthatz Mar 15, 2015
1371416
change login redirect to profile page to match assignment
constanthatz Mar 15, 2015
bdf0cdb
setUp for Profile Page test
constanthatz Mar 15, 2015
c6a2e30
more setUp for Profile Page test
constanthatz Mar 15, 2015
99065fd
test for profile page links, fix tests on imager_images
constanthatz Mar 15, 2015
7aa46cb
add test for profile image, no set profile image
constanthatz Mar 15, 2015
5eb4eda
add test for profile image, set profile image
constanthatz Mar 15, 2015
2b56244
add tests for # of photo and albums. phots test not working
constanthatz Mar 15, 2015
1f2198f
add test for # of followers
constanthatz Mar 15, 2015
5a4419f
add test for user info. change user model phonenumber field to use re…
constanthatz Mar 16, 2015
f1f3080
update requirements.txt
constanthatz Mar 16, 2015
a4cea38
add birthday test. phone number test broken, test fault not app fault…
constanthatz Mar 16, 2015
8150733
change Profile to user name in links to match assignment
constanthatz Mar 16, 2015
2b8eafa
add teardown methods to imager and user tests
constanthatz Mar 16, 2015
504fe68
remove unecessary assignments, fixed profile picture test. profile pi…
constanthatz Mar 16, 2015
089fa16
initialize library test
constanthatz Mar 16, 2015
864e110
setUp for library. clean up setUps
constanthatz Mar 16, 2015
cd16658
more setup for library
constanthatz Mar 16, 2015
2da71d3
fix phone number test for profile
constanthatz Mar 16, 2015
d5e25cd
profile image and photos tests partially fixed. factoryboy fails
constanthatz Mar 16, 2015
4243ea3
librarytestcase is not recognizing user for some reason
constanthatz Mar 16, 2015
514d55e
fix number of photos test in profile imager_user
constanthatz Mar 16, 2015
fc8e15d
clean up profile page tests
constanthatz Mar 16, 2015
cdbed1c
fix profile image test
constanthatz Mar 16, 2015
9fef6da
colletstatic. initialize more tests for library
constanthatz Mar 16, 2015
d517d7f
test for album links in library
constanthatz Mar 16, 2015
98a3af2
test for album titles in library
constanthatz Mar 16, 2015
6b472fb
remove uncessary else statements in library.html. start tests for lib…
constanthatz Mar 16, 2015
9358305
change default album cover to thumbnail. broken
constanthatz Mar 16, 2015
8970b57
updates requirements with boto and fabric, adds nginx_config and fabfile
henrykh Mar 16, 2015
60cbd22
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
henrykh Mar 16, 2015
1ba2fa9
adds gunicorn
henrykh Mar 16, 2015
7e4697b
revert album with no cover library view
constanthatz Mar 16, 2015
480d0d6
delete cached thumbnails
constanthatz Mar 16, 2015
0fd468c
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
constanthatz Mar 16, 2015
97d9bd5
change password hasher for faster development. continue thumbnail tes…
constanthatz Mar 16, 2015
0a16b67
test for all photos album cover
constanthatz Mar 16, 2015
905c25e
test for loose photos album cover
constanthatz Mar 16, 2015
6588687
test for album with no photos in it
constanthatz Mar 17, 2015
62415d8
work on deployment
henrykh Mar 17, 2015
f1f2468
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
henrykh Mar 17, 2015
d149343
add random cover selection from album photos if no cover and test for…
constanthatz Mar 17, 2015
610290a
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
constanthatz Mar 17, 2015
b59fd25
update requirements.txt
constanthatz Mar 17, 2015
452d21f
fix to dj db url
henrykh Mar 17, 2015
52ed0b3
resolve merge
henrykh Mar 17, 2015
d75e5de
moves fabfile into django-imager
henrykh Mar 17, 2015
41281d4
further db fixes
henrykh Mar 17, 2015
087847b
test for users photos in stream
constanthatz Mar 17, 2015
4315cf0
fix test for users photos in stream
constanthatz Mar 17, 2015
8d461ab
fix test for users photos in stream add followed users photos shared …
constanthatz Mar 17, 2015
599a804
test for followed user private photos not in stream
constanthatz Mar 17, 2015
88f1292
test for unfollowed user private photos not in stream
constanthatz Mar 17, 2015
21c10c1
test for order of photos in stream
constanthatz Mar 17, 2015
d39dde7
test for photo owner credit
constanthatz Mar 17, 2015
d8c1dfc
remove unecessary emailbackend override
constanthatz Mar 17, 2015
8e28399
remove unecessary imports
constanthatz Mar 17, 2015
4d7f67c
sets up prod and dev configs, work on adding upstart config
henrykh Mar 17, 2015
ba46ec7
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
henrykh Mar 17, 2015
7b9d3e6
update requirements.txt
constanthatz Mar 17, 2015
10e6d13
move debug toolbar app to dev
constanthatz Mar 17, 2015
5ee1079
fix toolbar app install in settings for debug
constanthatz Mar 17, 2015
a05199f
update requirements.txt
constanthatz Mar 17, 2015
e1fe12d
adds configurations to manage.py
henrykh Mar 17, 2015
04bc09c
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
henrykh Mar 17, 2015
b1dcaa4
updates requirements
henrykh Mar 17, 2015
75fce20
setup tests for photo update view
constanthatz Mar 17, 2015
3a4d902
add test for user album in photo update view, that is not the album t…
constanthatz Mar 17, 2015
a6da5bd
fixes to settings and wsgi
henrykh Mar 17, 2015
46eca0e
fix merge on wsgi
henrykh Mar 17, 2015
ec17888
working tests for album selection. user album selected, unselected an…
constanthatz Mar 17, 2015
1489ca8
test for photo title initial
constanthatz Mar 17, 2015
4e6e907
test for photo description initial
constanthatz Mar 17, 2015
5038621
test for photo date published initial
constanthatz Mar 17, 2015
2e9ec0a
test for photo published choices, selected and unselected
constanthatz Mar 17, 2015
4742a5c
fix album update view
constanthatz Mar 18, 2015
04b3032
initialize album update view tests and fix album update view fields
constanthatz Mar 18, 2015
a858c7a
fix setup for album update view test
constanthatz Mar 18, 2015
ce3b274
fix album update view to display user photos and redirect to library
constanthatz Mar 18, 2015
a2fc478
fix album update view save added photo to album
constanthatz Mar 18, 2015
f735de4
test for initial album title
constanthatz Mar 18, 2015
e09a573
test for initial album description
constanthatz Mar 18, 2015
1ab9732
test for initial album date_published
constanthatz Mar 18, 2015
9ab9832
test for initial album published choices
constanthatz Mar 18, 2015
2d83f18
fix abum update view to actual show all album photos as choices for c…
constanthatz Mar 18, 2015
3ed4cec
test for album cover choice not selected
constanthatz Mar 18, 2015
310a462
test for album cover choice selected
constanthatz Mar 18, 2015
52500c3
fix tests for album cover choice
constanthatz Mar 18, 2015
2ac19b5
test for album cover choice doesn"t include non user photo
constanthatz Mar 18, 2015
c72f133
test for album photo choices includes user photos
constanthatz Mar 18, 2015
40204a6
test for album photo choices includes all user photos
constanthatz Mar 18, 2015
b84216a
change album update view to not allow photos already in album to be a…
constanthatz Mar 18, 2015
ce19e3d
test for album photo choices includes user photos not in album
constanthatz Mar 18, 2015
991e21e
test for album photo choices includes user photos in album excluded
constanthatz Mar 18, 2015
053bb80
test for album photo add choice doesn"t include non user photo
constanthatz Mar 18, 2015
652a33e
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
constanthatz Mar 18, 2015
8aa5bf3
add links for add photo and add album to library
constanthatz Mar 18, 2015
fa9d2fa
updates to settings.py and fab to get prod working on instance
henrykh Mar 18, 2015
335cf25
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
henrykh Mar 18, 2015
58f2d01
hide date_published in phot update anad album update views, set publi…
constanthatz Mar 18, 2015
280fab6
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
constanthatz Mar 18, 2015
0d81e01
sets up email for prod
henrykh Mar 18, 2015
c12bc50
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
henrykh Mar 18, 2015
cfcbe5a
add DJANGO_CONFIGURATION to manage.py
constanthatz Mar 18, 2015
89f35bb
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
constanthatz Mar 18, 2015
ce57afa
update fabfile to look for the corret credentials and move class attr…
constanthatz Mar 19, 2015
40f6586
adds first selenium tests
henrykh Mar 19, 2015
dca82dc
adds media serving to nginx config
henrykh Mar 19, 2015
76e936a
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
henrykh Mar 19, 2015
3577817
fix following and blocking in profile update view
constanthatz Mar 19, 2015
9acc7eb
change redirect for add album view
constanthatz Mar 19, 2015
9a456c4
fix delete photo redirect
constanthatz Mar 19, 2015
660f5a9
move fields declaration to form for album add view, add album title t…
constanthatz Mar 19, 2015
30bd48f
remove delete links from album and photo create pages
constanthatz Mar 19, 2015
af78e4f
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
constanthatz Mar 19, 2015
ef71e9c
move css anf img files around, fix default album cover
constanthatz Mar 19, 2015
8cb81fe
update nginx config to accept large files and fix add album in update…
constanthatz Mar 19, 2015
7a4875a
adds test_login
henrykh Mar 19, 2015
1d5f347
adds logged in user test case, test of update profile link
henrykh Mar 19, 2015
38490b7
work on profile update tes, stream view tests
henrykh Mar 19, 2015
444bbc8
adds stream view test
henrykh Mar 19, 2015
bc9be68
work on library view to all photos test
henrykh Mar 19, 2015
9a49c66
fix profile picture test
constanthatz Mar 19, 2015
ed7ea4b
profile image thumbnail added
constanthatz Mar 20, 2015
1204a55
update requirements.txt and fab
constanthatz Mar 20, 2015
cd07594
updates environment vars
henrykh Mar 20, 2015
1d2e659
Merge branch 'front-end' of github.com:henrykh/django-imager into fro…
henrykh Mar 20, 2015
1af2928
change photo update redirect to either go to library, new album, or b…
constanthatz Mar 20, 2015
2b8327a
thumbnail added to photo update page
constanthatz Mar 20, 2015
abcaea8
made profile image clearable
constanthatz Mar 20, 2015
c602cf6
add cover thumbnail to album update view
constanthatz Mar 20, 2015
4ec524d
update fab
constanthatz Mar 20, 2015
2a4d0db
update requirements.txt
constanthatz Mar 20, 2015
b3eefa6
uncomments tests, minor linting
henrykh Mar 26, 2015
4f609dc
fix to profile update form to exclude the current user from available…
henrykh Apr 1, 2015
e7b46d4
updates profile update to make profile image non-required
henrykh Apr 1, 2015
08f8f0f
removes old code
henrykh Apr 1, 2015
1620156
Merge pull request #9 from henrykh/front-end
henrykh Apr 2, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,15 @@ coverage.xml

# Django stuff:
*.log
*.conf
media/

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Sublime
*.sublime-project
*.sublime-workspace
176 changes: 176 additions & 0 deletions fabfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
from fabric.api import run
from fabric.api import env
from fabric.api import prompt
from fabric.api import execute
from fabric.api import sudo
from fabric.contrib.files import upload_template
from fabric.contrib.project import rsync_project
import boto.ec2
import time
import os

env.hosts = ['localhost', ]
env.aws_region = 'us-west-2'
env.key_filename = '~/.ssh/codefellows.pem'


def host_type():
run('uname -s')


def get_ec2_connection():
if 'ec2' not in env:
conn = boto.ec2.connect_to_region(env.aws_region, profile_name='djangoimager')
if conn is not None:
env.ec2 = conn
print "Connected to EC2 region %s" % env.aws_region
else:
msg = "Unable to connect to EC2 region %s"
raise IOError(msg % env.aws_region)
return env.ec2


def provision_instance(wait_for_running=False, timeout=60, interval=2):
wait_val = int(interval)
timeout_val = int(timeout)
conn = get_ec2_connection()
instance_type = 't1.micro'
key_name = 'codefellows'
security_group = 'ssh-access'
image_id = 'ami-d0d8b8e0'

reservations = conn.run_instances(
image_id,
key_name=key_name,
instance_type=instance_type,
security_groups=[security_group, ]
)
new_instances = [i for i in reservations.instances if i.state == u'pending']
running_instance = []
if wait_for_running:
waited = 0
while new_instances and (waited < timeout_val):
time.sleep(wait_val)
waited += int(wait_val)
for instance in new_instances:
state = instance.state
print "Instance %s is %s" % (instance.id, state)
if state == "running":
running_instance.append(
new_instances.pop(new_instances.index(i))
)
instance.update()


def list_aws_instances(verbose=False, state='all'):
conn = get_ec2_connection()

reservations = conn.get_all_reservations()
instances = []
for res in reservations:
for instance in res.instances:
if state == 'all' or instance.state == state:
instance = {
'id': instance.id,
'type': instance.instance_type,
'image': instance.image_id,
'state': instance.state,
'instance': instance,
}
instances.append(instance)
env.instances = instances
if verbose:
import pprint
pprint.pprint(env.instances)


def select_instance(state='running'):
if env.get('active_instance', False):
return

list_aws_instances(state=state)

prompt_text = "Please select from the following instances:\n"
instance_template = " %(ct)d: %(state)s instance %(id)s\n"
for idx, instance in enumerate(env.instances):
ct = idx + 1
args = {'ct': ct}
args.update(instance)
prompt_text += instance_template % args
prompt_text += "Choose an instance: "

def validation(input):
choice = int(input)
if choice not in range(1, len(env.instances) + 1):
raise ValueError("%d is not a valid instance" % choice)
return choice

choice = prompt(prompt_text, validate=validation)
env.active_instance = env.instances[choice - 1]['instance']


def run_command_on_selected_server(command):
select_instance()
selected_hosts = [
'ubuntu@' + env.active_instance.public_dns_name
]
execute(command, hosts=selected_hosts)


def _install_nginx():
sudo('apt-get update')
sudo('apt-get install nginx')
sudo('/etc/init.d/nginx start')


def install_nginx():
run_command_on_selected_server(_install_nginx)


def install_supervisor():
run_command_on_selected_server(_install_gunicorn)


def _install_gunicorn():
sudo("apt-get install gunicorn")


def run_app():
run_command_on_selected_server(_run_app)


def _run_app():
sudo('gunicorn gunicorn -b 127.0.0.1:8000 -w 4 -D imager.wsgi')


def _configure_nginx():
sudo('mv simple_nginx_config /etc/nginx/sites-available/default')
sudo('/etc/init.d/nginx restart')


def _configure_upstart():
sudo('mv djangoimager.conf /etc/init/djangoimager.conf')
sudo('service djangoimager restart')


def configure_upstart():
run_command_on_selected_server(_configure_upstart)


def configure_nginx():
run_command_on_selected_server(_configure_nginx)


def deploy():
run_command_on_selected_server(_deploy)


def _deploy():
# os.system('pip freeze > requirements.txt')
rsync_project(
remote_dir="/home/ubuntu",
local_dir="../django-imager/",
exclude=['.git/', '*.pyc', 'media/', 'tests.py'])
run('python manage.py collectstatic')
# sudo('pip install -r requirements.txt')
sudo('service djangoimager restart')
File renamed without changes.
83 changes: 0 additions & 83 deletions imager/imager/settings.py

This file was deleted.

10 changes: 0 additions & 10 deletions imager/imager/urls.py

This file was deleted.

6 changes: 6 additions & 0 deletions imager/production.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from settings import *

DEBUG = False
TEMPLATE_DEBUG = False
ALLOWED_HOSTS = ['http://ec2-54-148-68-112.us-west-2.compute.amazonaws.com/', 'localhost']
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
Loading