parent
d8d141be03
commit
0f3af12bd9
2 changed files with 0 additions and 131 deletions
@ -1,65 +0,0 @@ |
|||||||
.PHONY: requirements requirements-upgrade freeze syncdb run run-public makemessages compilemessages collectstatic cloc clean user south |
|
||||||
|
|
||||||
project_name=proj
|
|
||||||
|
|
||||||
requirements: |
|
||||||
-@echo "### Installing requirements"
|
|
||||||
-@pip install -r requirements.txt
|
|
||||||
|
|
||||||
requirements-upgrade: |
|
||||||
-@echo "### Upgrading requirements"
|
|
||||||
-@pip freeze | cut -d = -f 1 | xargs pip install -U
|
|
||||||
|
|
||||||
freeze: |
|
||||||
-@echo "### Freezing python packages to requirements.txt"
|
|
||||||
-@pip freeze > requirements.txt
|
|
||||||
|
|
||||||
syncdb: |
|
||||||
-@echo "### Creating database tables and loading fixtures"
|
|
||||||
@PYTHONPATH=$(PYTHONPATH):. DJANGO_SETTINGS_MODULE=$(project_name).settings ipython manage.py syncdb --noinput
|
|
||||||
@PYTHONPATH=$(PYTHONPATH):. DJANGO_SETTINGS_MODULE=$(project_name).settings ipython manage.py migrate
|
|
||||||
|
|
||||||
run: |
|
||||||
@PYTHONPATH=$(PYTHONPATH):. DJANGO_SETTINGS_MODULE=$(project_name).settings ipython manage.py runserver
|
|
||||||
|
|
||||||
run-public: |
|
||||||
@PYTHONPATH=$(PYTHONPATH):. DJANGO_SETTINGS_MODULE=$(project_name).settings ipython manage.py runserver 0.0.0.0:8000
|
|
||||||
|
|
||||||
shell: |
|
||||||
@PYTHONPATH=$(PYTHONPATH):. DJANGO_SETTINGS_MODULE=$(project_name).settings python manage.py shell
|
|
||||||
|
|
||||||
makemessages: |
|
||||||
-@ipython manage.py makemessages --all
|
|
||||||
|
|
||||||
compilemessages: |
|
||||||
-@ipython manage.py compilemessages
|
|
||||||
|
|
||||||
collectstatic: |
|
||||||
@ipython manage.py collectstatic
|
|
||||||
|
|
||||||
user: |
|
||||||
-@ipython manage.py createsuperuser
|
|
||||||
|
|
||||||
# If the first argument is "south"...
|
|
||||||
ifeq (south,$(firstword $(MAKECMDGOALS))) |
|
||||||
# use the rest as arguments for "south"
|
|
||||||
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
|
|
||||||
# ...and turn them into do-nothing targets
|
|
||||||
$(eval $(RUN_ARGS):;@:)
|
|
||||||
endif |
|
||||||
south: |
|
||||||
-@python manage.py schemamigration $(RUN_ARGS) --auto
|
|
||||||
-@python manage.py migrate $(RUN_ARGS)
|
|
||||||
|
|
||||||
cloc: |
|
||||||
-@echo "### Counting lines of code within the project"
|
|
||||||
-@echo "# Total:" ; find . -iregex '.*\.py\|.*\.js\|.*\.html\|.*\.css' -type f -exec cat {} + | wc -l
|
|
||||||
-@echo "# Python:" ; find . -name '*.py' -type f -exec cat {} + | wc -l
|
|
||||||
-@echo "# JavaScript:" ; find . -name '*.js' -type f -exec cat {} + | wc -l
|
|
||||||
-@echo "# HTML:" ; find . -name '*.html' -type f -exec cat {} + | wc -l
|
|
||||||
-@echo "# CSS:" ; find . -name '*.css' -type f -exec cat {} + | wc -l
|
|
||||||
|
|
||||||
clean: |
|
||||||
-@echo "### Cleaning *.pyc and .DS_Store files "
|
|
||||||
-@find . -name '*.pyc' -exec rm -f {} \;
|
|
||||||
-@find . -name '.DS_Store' -exec rm -f {} \;
|
|
||||||
@ -1,66 +0,0 @@ |
|||||||
# -*- coding: utf-8 -*- |
|
||||||
from os.path import join, basename |
|
||||||
|
|
||||||
from fabric.api import * |
|
||||||
|
|
||||||
env.roledefs = { |
|
||||||
'dev': ['root@176.121.11.165'], |
|
||||||
'prod': ['root@176.121.11.162'], |
|
||||||
} |
|
||||||
env.passwords = { |
|
||||||
'root@176.121.11.165:22': 'ue6R287QZfMc', |
|
||||||
'root@176.121.11.162:22': 'XcS2jx5e8k6n', |
|
||||||
} |
|
||||||
|
|
||||||
REMOTE_HOME_DIR = '/home/www/expomap/' |
|
||||||
LOCAL_HOME_DIR = '/home/alexander/projects/expomap/' |
|
||||||
|
|
||||||
nginx_conf = '/etc/nginx/sites-available/hit.expomap.ru' |
|
||||||
apache2_conf = '/etc/apache2/sites-available/proj.com' |
|
||||||
settings_conf = join(REMOTE_HOME_DIR, 'proj/settings.py') |
|
||||||
|
|
||||||
|
|
||||||
def set_host(host): |
|
||||||
env.hosts = env.roledefs.get(host) |
|
||||||
env.role = host |
|
||||||
|
|
||||||
|
|
||||||
def dev(): |
|
||||||
set_host('dev') |
|
||||||
|
|
||||||
|
|
||||||
def prod(): |
|
||||||
set_host('prod') |
|
||||||
|
|
||||||
|
|
||||||
def get_configs(): |
|
||||||
localdir = join(LOCAL_HOME_DIR, 'support/', env.role) |
|
||||||
get(nginx_conf, localdir) |
|
||||||
get(apache2_conf, localdir) |
|
||||||
get(join(REMOTE_HOME_DIR, 'schema.xml'), localdir) |
|
||||||
get(settings_conf, localdir) |
|
||||||
|
|
||||||
|
|
||||||
def put_configs(): |
|
||||||
localdir = join(LOCAL_HOME_DIR, 'support/', env.role) |
|
||||||
# nginx |
|
||||||
put(join(localdir, basename(nginx_conf)), |
|
||||||
nginx_conf) |
|
||||||
# apache2 |
|
||||||
put(join(localdir, basename(apache2_conf)), |
|
||||||
apache2_conf) |
|
||||||
# settings |
|
||||||
# put(join(localdir, basename(settings_conf)), |
|
||||||
# settings_conf) |
|
||||||
|
|
||||||
|
|
||||||
def call_state(state): |
|
||||||
run('service apache2 {state}'.format(state=state)) |
|
||||||
run('service nginx {state}'.format(state=state)) |
|
||||||
|
|
||||||
|
|
||||||
def put_1345(): |
|
||||||
call_state('stop') |
|
||||||
run('git pull') |
|
||||||
put_configs() |
|
||||||
call_state('start') |
|
||||||
Loading…
Reference in new issue