-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Patch for step # #43
base: master
Are you sure you want to change the base?
Patch for step # #43
Changes from 29 commits
3858c5d
6a88a1b
548eb86
d7d29bd
04771ab
e763972
8d6f4d2
7b89f24
c7e858b
59f476b
008795e
7ceaaa4
2d03683
071dae9
cb20e0a
a263a96
6278bad
9712373
3a5b3d7
97c075a
bf529cd
f7a6f32
e2a2a15
b100bcd
78904ce
b5812e6
e95284c
c786c5a
193f377
97bf598
86f1c65
f77716f
477f940
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
# Script to install virtual environment for truffe2 for developpement | ||
# --- DO NOT USE IN PRODUCTION MODE --- | ||
|
||
set -e | ||
set +x | ||
|
||
project_dir="$(dirname $(dirname $(readlink -f "$0")))" | ||
|
||
if [ "$1" != "noclean" ] | ||
then | ||
rm -rf "$project_dir/venv" | ||
python3 -m virtualenv --python python3.7 "$project_dir/venv" | ||
|
||
. "$project_dir/venv/bin/activate" | ||
pip install -U pip | ||
pip install -r "$project_dir/truffe2/data/pip-reqs.txt" | ||
else | ||
. "$project_dir/venv/bin/activate" | ||
fi | ||
|
||
rm -rf "$project_dir/truffe2/db.sqlite3" | ||
cp "$project_dir/tools/settingsLocal.py.test" "$project_dir/truffe2/app/settingsLocal.py" | ||
|
||
( | ||
cd "$project_dir/truffe2" | ||
python manage.py migrate | ||
if [ "$2" == "demo" ] | ||
then | ||
echo 'from main.test_data import setup_testing_all_data; setup_testing_all_data()' | python manage.py shell | ||
fi | ||
) |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,16 @@ | ||||||
#!/bin/bash | ||||||
|
||||||
set +e | ||||||
set +x | ||||||
|
||||||
project_dir=$(dirname $(dirname $(readlink -f "$0"))) | ||||||
|
||||||
rm -rf $project_dir/htmlcov | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good idea to protect about this bad using |
||||||
. $project_dir/venv/bin/activate | ||||||
|
||||||
cd $project_dir/truffe2 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good idea to protect about this bad using |
||||||
python -m pip install -U coverage >/dev/null | ||||||
python -m coverage erase | ||||||
python -m coverage run --branch --source=. manage.py test | ||||||
# python -m coverage report | ||||||
python -m coverage html -d $project_dir/htmlcov | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good idea to protect about this bad using |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from os.path import join, dirname, abspath | ||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': join(dirname(dirname(abspath(__file__))), 'db.sqlite3'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it really a good idea to use a sqlite3 database since it's not what is used in production ? I suggest using the same database to avoid potential issues There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMHO the production database sets even a higher barrier to potentially new developers. I'd rather stay with something simple and if a CI is ever implemented use the production configuration there. In any case, it should be easily replaceable (e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Developers should use the correct database, especially dues to various small changes that can lead to misbehavior and/or missing features. Tests are meaningless if they fail or not depending on the context. Developers should not use sqlite3. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's hard to find developers motivated to code truffe ! I'm against creating supplementary barrier. And Django provide a correct abstraction of the database. To my opinion, we should instead avoid database specific code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to decide on this @the-glu ! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I support @TeoGoddet's argument on this one. |
||
} | ||
} | ||
|
||
SECRET_KEY = "_____________________________________________________" | ||
|
||
# Deactivate Haystack indexing on save | ||
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.BaseSignalProcessor' | ||
|
||
# Logging to console, for debug :) | ||
LOGGING = { | ||
'disable_existing_loggers': False, | ||
'version': 1, | ||
'formatters': { | ||
'verbose': { | ||
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s' | ||
}, | ||
'simple': { | ||
'format': '%(levelname)s %(message)s' | ||
}, | ||
}, | ||
'handlers': { | ||
'console': { | ||
'level': 'DEBUG', | ||
'class': 'logging.StreamHandler', | ||
'formatter': 'simple' | ||
}, | ||
}, | ||
'loggers': { | ||
'django': { | ||
'handlers': ['console'], | ||
'level': 'DEBUG', | ||
'propagate': True, | ||
}, | ||
|
||
'django.template': { | ||
'handlers': ['console'], | ||
'level': 'INFO', | ||
'propagate': True, | ||
}, | ||
|
||
'django.db.backends': { | ||
'handlers': ['console'], | ||
'level': 'ERROR', | ||
'propagate': False, | ||
}, | ||
}, | ||
} | ||
|
||
EMAIL_HOST = 'localhost' | ||
EMAIL_PORT = 1025 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normaly, good developper don't use space in working directory ;)
But, it's a good idea to protect about this bad using