forked from diogolmenezes/django-new-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiniciar-projeto.sh
executable file
·49 lines (41 loc) · 1.3 KB
/
iniciar-projeto.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
if [ -z $1 ]
then
echo -e "\t\aInsira o nome do projeto"
exit
fi
#criando e configurando virtual env
virtualenv --no-site-packages --distribute --unzip-setuptools ve$1
cd ve$1
source bin/activate
pip install django
#criando e configurando projeto
django-admin.py startproject $1 .
cd $1
#transformando o settings em modulo
mkdir settings
mv settings.py settings/production.py
touch settings/{__init__,stage,development}.py
echo "from production import *" > settings/stage.py
echo "from production import *" > settings/development.py
echo "import os" > settings/__init__.py
echo "global_settings = os.path.join(os.path.dirname(__file__), 'development.py')" >> settings/__init__.py
echo "execfile(global_settings)" >> settings/__init__.py
#criando e configurando a aplicacao
django-admin.py startapp core
mkdir static #diretorio para collect static
mkdir media
mkdir -p core/templates/core
mkdir -p core/static/{css,img,js}
#transformando os testes em modulo
mkdir core/tests
mv core/tests.py core/tests/simple_test.py
echo "from .simple_test import *" > core/tests/__init__.py
#criando o arquivo de requirements
pip freeze | grep -i django > requirements.txt
#configurando o repositorio do git
git init
echo "*.pyc" > .gitignore
git add .
git commit -m "first commit :)"
#iniciando o servidor
python ../manage.py runserver