Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django2-project-template
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django2-project-template
Commits
1afae0fa
Kaydet (Commit)
1afae0fa
authored
May 03, 2019
tarafından
Batuhan Taşkaya
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
pipenv support
üst
699a11c5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
90 additions
and
99 deletions
+90
-99
.travis.yml
.travis.yml
+3
-2
Pipfile
Pipfile
+34
-0
Pipfile.lock
Pipfile.lock
+0
-0
README.md
README.md
+51
-64
install.sh
install.sh
+2
-2
requirements.txt
requirements.txt
+0
-2
base.pip
requirements/base.pip
+0
-6
development.pip
requirements/development.pip
+0
-18
heroku.pip
requirements/heroku.pip
+0
-4
travis.pip
requirements/travis.pip
+0
-1
No files found.
.travis.yml
Dosyayı görüntüle @
1afae0fa
...
...
@@ -6,8 +6,9 @@ before_script:
python
:
-
"
3.7-dev"
install
:
-
pip install -r requirements/travis.pip
-
pip install pipenv
-
pipenv install
env
:
-
DJANGO_ENV=travis
script
:
-
python manage.py test applications -v 2
-
p
ipenv run p
ython manage.py test applications -v 2
Pipfile
0 → 100644
Dosyayı görüntüle @
1afae0fa
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
ipython = "==7.4.0"
bpython = "==0.18"
django-debug-toolbar = "==1.11"
coverage = "==4.5.3"
isort = "==4.3.16"
black = "==19.3b0"
flake8 = "==3.7.7"
flake8-bandit = "==2.1.0"
flake8-blind-except = "==0.1.1"
flake8-bugbear = "==18.8.0"
flake8-builtins = "==1.4.1"
flake8-polyfill = "==1.0.2"
flake8-print = "==3.1.0"
flake8-quotes = "==1.0.0"
flake8-string-format = "==0.2.3"
pylint = "==2.3.1"
Werkzeug = "==0.15.2"
[packages]
django-extensions = "==2.1.6"
python-slugify = "==3.0.2"
psycopg2-binary = "==2.8"
dj-database-url = "==0.5.0"
Django = "==2.2"
Pillow = "==6.0.0"
[requires]
python_version = "3.7"
Pipfile.lock
0 → 100644
Dosyayı görüntüle @
1afae0fa
This diff is collapsed.
Click to expand it.
README.md
Dosyayı görüntüle @
1afae0fa
...
...
@@ -13,7 +13,7 @@ Django releases as much as I can!
-
Latest
`Python 3.7.0`
runtime environment.
-
`PostgreSQL`
-
`pip
`
,
`virtualenv`
,
`virtualenvwrapper
`
-
`pip
env
`
-
If you like to run Rake Tasks, you need
`Ruby`
too but not required:
`2.5.0`
## Installation
...
...
@@ -31,30 +31,20 @@ database:
$
createdb my_project_dev
```
Please use
`virtualenvwrapper`
and create your environment and activate it.
With Python 3.3+, you don’t need to install
`virtualenv`
. You can create your
environment via;
`python -m venv /path/to/your/environment`
Use pipenv to activate your virtual environment if that exists else create one and activate.
```
bash
# example
$
mkvirtualenv my_projects_env
# or make it active:
$
workon my_projects_env
$
pipenv shell
```
You need to declare
**3 environment**
variables. I always put my project
specific environment variables under
`virtualenvwrapper`
’s
`postactivate`
file. Open your
`~/.virtualenvs/my_projects_env/bin/postactivate`
and add
these lines (
*or set it manually*
):
You need to declare
**3 environment**
variables.
```
bash
export
DJANGO_ENV
=
"development"
export
DJANGO_SECRET
=
"YOUR-SECRET-HERE"
# will fix it in a second.
export
DATABASE_URL
=
"postgres://localhost:5432/my_project_dev"
```
then trigger
`workon my_projects_env`
, this reloads environment variables
.
If you put them into an
`.env`
file pipenv will automatically load them
.
then;
```
bash
...
...
@@ -69,7 +59,7 @@ $ cp config/settings/development.example.py config/settings/development.py
$
cp
config/settings/test.example.py config/settings/test.py
# development.py is not under revison control
# test.py is not under revison control
$
pip
install
-r
requirements/development.pip
$
pip
env
install
$
git init
# now you can start your own repo!
```
...
...
@@ -78,7 +68,7 @@ or, you can use installer script:
```
bash
$
bash <
(
curl
-fsSL
https://raw.githubusercontent.com/vigo/django2-project-template/master/install.sh
)
$
cd
YOUR_PROJECT/
$
pip
install
-r
requirements/development.pip
$
pip
env
install
$
git init
# now you can start your own repo!
```
...
...
@@ -502,10 +492,6 @@ Here is directory/file structure:
├── db
├── locale
│ └──
tr
├── requirements
│ ├── base.pip
│ ├── development.pip
│ └── heroku.pip
├── static
│ └── css
├── templates
...
...
@@ -515,7 +501,8 @@ Here is directory/file structure:
├── Procfile
├── Rakefile
├── manage.py
├── requirements.txt
├── Pipfile
├── Pipfile.lock
└── runtime.txt
```
...
...
@@ -538,15 +525,16 @@ All the other settings files (*according to environment*) imports
un-tracked/git-ignored file. Original file is
`development.example.py`
. You
need to create a copy of it! (
*if you follow along from the beginning, you’ve already did this*
)
All the base/common required Python packages/modules are defined under
`
requirements/base.pip`
:
All the base/common required Python packages/modules are defined under
`
Pipfile`
's
`packages`
scope.
:
```
bash
Django
==
2.2
Pillow
==
6.0.0
django-extensions
==
2.1.6
python-slugify
==
3.0.2
psycopg2-binary
==
2.8
dj-database-url
==
0.5.0
[
packages]
django-extensions
=
"==2.1.6"
python-slugify
=
"==3.0.2"
psycopg2-binary
=
"==2.8"
dj-database-url
=
"==0.5.0"
Django
=
"==2.2"
Pillow
=
"==6.0.0"
```
### `base.py`
...
...
@@ -658,26 +646,33 @@ mode.
simple passwords such as
`1234`
.
`MEDIA_ROOT`
is set to basedir’s
`media`
folder,
`STATICFILES_DIRS`
includes basedir’s
`static`
folder.
All the required modules are defined under
`
requirements/development.pip`
:
All the required modules are defined under
`
Pipfile`
's
`dev-packages`
scope.
:
```
bash
-r
base.pip
ipython
==
7.4.0
Werkzeug
==
0.15.2
django-debug-toolbar
==
1.11
coverage
==
4.5.3
isort
==
4.3.16
black
==
19.3b0
flake8
==
3.7.7
flake8-bandit
==
2.1.0
flake8-blind-except
==
0.1.1
flake8-bugbear
==
18.8.0
flake8-builtins
==
1.4.1
flake8-polyfill
==
1.0.2
flake8-print
==
3.1.0
flake8-quotes
==
1.0.0
flake8-string-format
==
0.2.3
pylint
==
2.3.1
[
dev-packages]
ipython
=
"==7.4.0"
bpython
=
"==0.18"
django-debug-toolbar
=
"==1.11"
coverage
=
"==4.5.3"
isort
=
"==4.3.16"
black
=
"==19.3b0"
flake8
=
"==3.7.7"
flake8-bandit
=
"==2.1.0"
flake8-blind-except
=
"==0.1.1"
flake8-bugbear
=
"==18.8.0"
flake8-builtins
=
"==1.4.1"
flake8-polyfill
=
"==1.0.2"
flake8-print
=
"==3.1.0"
flake8-quotes
=
"==1.0.0"
flake8-string-format
=
"==0.2.3"
pylint
=
"==2.3.1"
Werkzeug
=
"==0.15.2"
```
They can be installed by;
```
$ pipenv install --dev
```
### `test.example.py`
...
...
@@ -703,18 +698,11 @@ ALLOWED_HOSTS = [
]
```
All the required modules are defined under
`requirements/heroku.pip`
:
Heroku supports Pipenv as native but you need to install few dependicies for heroku
separately.
```
bash
-r
base.pip
gunicorn
==
19.9.0
whitenoise
==
4.1.2
```
By default, Heroku requires
`requirements.txt`
. Therefore we have it too :)
```
python
-
r
requirements
/
heroku
.
pip
pipenv
install
gunicorn whitenoise
```
Heroku also requires
`Procfile`
and
`runtime.txt`
. Both provided in the basedir.
...
...
@@ -736,10 +724,9 @@ $ heroku run python manage.py createsuperuser
If you are using different platform or OS, such as Ubuntu or your custom
servers, you can follow the settings and requirements conventions. If you name
it
`production`
, create your
`config/settings/production.py`
and
`requirements/production.pip`
. You must set you
`DJANGO_ENV`
to
`production`
and don’t forget to set
`DJANGO_ENV`
and
`DJANGO_SECRET`
on your production
server!
it
`production`
, create your
`config/settings/production.py`
. You must set you
`DJANGO_ENV`
to
`production`
and don’t forget to set
`DJANGO_ENV`
and
`DJANGO_SECRET`
on your production server!
---
...
...
@@ -1182,8 +1169,8 @@ class MyAdmin(admin.ModelAdmin):
}
```
This widget uses
`Pillow`
(
*Python Image Library*
) which ships with your
`
base.pip
`
requirements file.
Show image preview, width x height if the file is image.
This widget uses
`Pillow`
(
*Python Image Library*
) which ships with your
`
Pipfile
`
Show image preview, width x height if the file is image.
---
...
...
install.sh
Dosyayı görüntüle @
1afae0fa
...
...
@@ -71,9 +71,9 @@ cp config/settings/test.example.py config/settings/test.py &&
echo
echo
printf
"
${
color_2
}
Installation completed...
${
color_r
}
\n\n
"
echo
-e
"
\t
Now,
create your virtual environment and run
:"
echo
-e
"
\t
Now,
set-up your dependicies by running
:"
echo
echo
-e
"
\t
cd
${
PROJECT_NAME
}
/"
echo
-e
"
\t
pip
install -r requirements/development.pip
"
echo
-e
"
\t
pip
env install
"
echo
echo
requirements.txt
deleted
100644 → 0
Dosyayı görüntüle @
699a11c5
-r requirements/heroku.pip
\ No newline at end of file
requirements/base.pip
deleted
100644 → 0
Dosyayı görüntüle @
699a11c5
Django==2.2
Pillow==6.0.0
django-extensions==2.1.6
python-slugify==3.0.2
psycopg2-binary==2.8
dj-database-url==0.5.0
requirements/development.pip
deleted
100644 → 0
Dosyayı görüntüle @
699a11c5
-r base.pip
ipython==7.4.0
bpython==0.18
Werkzeug==0.15.2
django-debug-toolbar==1.11
coverage==4.5.3
isort==4.3.16
black==19.3b0
flake8==3.7.7
flake8-bandit==2.1.0
flake8-blind-except==0.1.1
flake8-bugbear==18.8.0
flake8-builtins==1.4.1
flake8-polyfill==1.0.2
flake8-print==3.1.0
flake8-quotes==1.0.0
flake8-string-format==0.2.3
pylint==2.3.1
requirements/heroku.pip
deleted
100644 → 0
Dosyayı görüntüle @
699a11c5
-r base.pip
gunicorn==19.9.0
whitenoise==4.1.2
\ No newline at end of file
requirements/travis.pip
deleted
100644 → 0
Dosyayı görüntüle @
699a11c5
-r base.pip
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment