remove pipenv (#642)
* remove pipenv * Maybe fixing appveyor * add python to path * omg * put the migrate back * remove pipenv * Maybe fixing appveyor * add python to path * omg * put the migrate back * force host for psql * set user to postgres
This commit is contained in:
Родитель
a68f53bbb7
Коммит
7198461f81
|
@ -79,6 +79,7 @@ client_secrets.json
|
|||
|
||||
# virtualenv
|
||||
venv
|
||||
pulsevenv/
|
||||
|
||||
#Editor
|
||||
/.vscode/
|
||||
|
|
15
.travis.yml
15
.travis.yml
|
@ -1,25 +1,26 @@
|
|||
# Activate Build Config Validation on Travis
|
||||
version: ~> 1.0
|
||||
|
||||
language: python
|
||||
cache: pip
|
||||
|
||||
python:
|
||||
- "3.7.6"
|
||||
- "3.7"
|
||||
|
||||
services: postgresql
|
||||
|
||||
# command to install dependencies
|
||||
install:
|
||||
- pip install --upgrade pip
|
||||
- pip install pipenv
|
||||
- pipenv install --dev --deploy
|
||||
|
||||
- pip install -r requirements.txt -r dev-requirements.txt
|
||||
before_script:
|
||||
- psql -c "CREATE DATABASE pulseapi;" -U postgres
|
||||
- pipenv run python manage.py migrate
|
||||
- python manage.py migrate
|
||||
|
||||
# command to run tests
|
||||
script:
|
||||
- pipenv run flake8 pulseapi --config=./pulseapi/tox.ini
|
||||
- pipenv run python manage.py test
|
||||
- flake8 pulseapi
|
||||
- python manage.py test
|
||||
|
||||
env:
|
||||
global:
|
||||
|
|
34
Pipfile
34
Pipfile
|
@ -1,34 +0,0 @@
|
|||
[[source]]
|
||||
url = "https://pypi.python.org/simple"
|
||||
verify_ssl = true
|
||||
name = "pypi"
|
||||
|
||||
[packages]
|
||||
boto3 = "*"
|
||||
dj-database-url = "*"
|
||||
Django = "==2.2.11"
|
||||
django-cors-headers = "*"
|
||||
django-debug-toolbar = "*"
|
||||
django-ajax-selects = "==1.9.1"
|
||||
django-environ = "*"
|
||||
django-filter = "==2.2"
|
||||
django-storages = "*"
|
||||
djangorestframework = "==3.11.0"
|
||||
factory_boy = "*"
|
||||
Faker = "*"
|
||||
google-api-python-client = "*"
|
||||
gunicorn = "*"
|
||||
Pillow = "*"
|
||||
requests = "*"
|
||||
whitenoise = "*"
|
||||
"psycopg2-binary" = "*"
|
||||
django-allauth = "==0.40.0"
|
||||
oauth2client = "*"
|
||||
|
||||
[dev-packages]
|
||||
autoflake = "*"
|
||||
docutils = "*"
|
||||
flake8 = "*"
|
||||
|
||||
[requires]
|
||||
python_version = "3.7"
|
|
@ -1,459 +0,0 @@
|
|||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "ff2e343489a44cb6667b37b42b7bba3abd6e5c8914dc1aa28042b6ba14b845fa"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
"python_version": "3.7"
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
"name": "pypi",
|
||||
"url": "https://pypi.python.org/simple",
|
||||
"verify_ssl": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"default": {
|
||||
"boto3": {
|
||||
"hashes": [
|
||||
"sha256:5e145fa27b56c6f3db20c20d4e0084e146a400007064af8d46c1b3bfcc779c42",
|
||||
"sha256:95d2fb21e3f0575f8b599706100c42a5a7ae576671f6f4beea6e42ab0f57166b"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==1.12.18"
|
||||
},
|
||||
"botocore": {
|
||||
"hashes": [
|
||||
"sha256:2f1a54e19531bdf2d953c2db5f76b49c6936565366b2503a528b04cbbf55671a",
|
||||
"sha256:9827c6f3bffb9e316427c276e3f22e5d82b377dd43dcbbbe71ecbd9ac2b959ab"
|
||||
],
|
||||
"version": "==1.15.18"
|
||||
},
|
||||
"cachetools": {
|
||||
"hashes": [
|
||||
"sha256:9a52dd97a85f257f4e4127f15818e71a0c7899f121b34591fcc1173ea79a0198",
|
||||
"sha256:b304586d357c43221856be51d73387f93e2a961598a9b6b6670664746f3b6c6c"
|
||||
],
|
||||
"version": "==4.0.0"
|
||||
},
|
||||
"certifi": {
|
||||
"hashes": [
|
||||
"sha256:017c25db2a153ce562900032d5bc68e9f191e44e9a0f762f373977de9df1fbb3",
|
||||
"sha256:25b64c7da4cd7479594d035c08c2d809eb4aab3a26e5a990ea98cc450c320f1f"
|
||||
],
|
||||
"version": "==2019.11.28"
|
||||
},
|
||||
"chardet": {
|
||||
"hashes": [
|
||||
"sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae",
|
||||
"sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"
|
||||
],
|
||||
"version": "==3.0.4"
|
||||
},
|
||||
"defusedxml": {
|
||||
"hashes": [
|
||||
"sha256:6687150770438374ab581bb7a1b327a847dd9c5749e396102de3fad4e8a3ef93",
|
||||
"sha256:f684034d135af4c6cbb949b8a4d2ed61634515257a67299e5f940fbaa34377f5"
|
||||
],
|
||||
"version": "==0.6.0"
|
||||
},
|
||||
"dj-database-url": {
|
||||
"hashes": [
|
||||
"sha256:4aeaeb1f573c74835b0686a2b46b85990571159ffc21aa57ecd4d1e1cb334163",
|
||||
"sha256:851785365761ebe4994a921b433062309eb882fedd318e1b0fcecc607ed02da9"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==0.5.0"
|
||||
},
|
||||
"django": {
|
||||
"hashes": [
|
||||
"sha256:65e2387e6bde531d3bb803244a2b74e0253550a9612c64a60c8c5be267b30f50",
|
||||
"sha256:b51c9c548d5c3b3ccbb133d0bebc992e8ec3f14899bce8936e6fdda6b23a1881"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==2.2.11"
|
||||
},
|
||||
"django-ajax-selects": {
|
||||
"hashes": [
|
||||
"sha256:8c14a1cfb69572228f78301be4df1cec149bd74158cf766da690686dd5b5f11f",
|
||||
"sha256:ede00165f9e15077be9ecb1d785b253b75598bbdbccfb61c7f559d4937e257f9"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==1.9.1"
|
||||
},
|
||||
"django-allauth": {
|
||||
"hashes": [
|
||||
"sha256:6a189fc4d3ee23596c3fd6e9f49c59b5b15618980118171a50675dd6a27cc589"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==0.40.0"
|
||||
},
|
||||
"django-cors-headers": {
|
||||
"hashes": [
|
||||
"sha256:a5960addecc04527ab26617e51b8ed42f0adab4594b24bb0f3c33e2bd3857c3f",
|
||||
"sha256:a785b5f446f6635810776d9f5f5d23e6a2a2f728ea982648370afaf0dfdf2627"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==3.2.1"
|
||||
},
|
||||
"django-debug-toolbar": {
|
||||
"hashes": [
|
||||
"sha256:eabbefe89881bbe4ca7c980ff102e3c35c8e8ad6eb725041f538988f2f39a943",
|
||||
"sha256:ff94725e7aae74b133d0599b9bf89bd4eb8f5d2c964106e61d11750228c8774c"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==2.2"
|
||||
},
|
||||
"django-environ": {
|
||||
"hashes": [
|
||||
"sha256:6c9d87660142608f63ec7d5ce5564c49b603ea8ff25da595fd6098f6dc82afde",
|
||||
"sha256:c57b3c11ec1f319d9474e3e5a79134f40174b17c7cc024bbb2fad84646b120c4"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==0.4.5"
|
||||
},
|
||||
"django-filter": {
|
||||
"hashes": [
|
||||
"sha256:558c727bce3ffa89c4a7a0b13bc8976745d63e5fd576b3a9a851650ef11c401b",
|
||||
"sha256:c3deb57f0dd7ff94d7dce52a047516822013e2b441bed472b722a317658cfd14"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==2.2"
|
||||
},
|
||||
"django-storages": {
|
||||
"hashes": [
|
||||
"sha256:3103991c2ee8cef8a2ff096709973ffe7106183d211a79f22cf855f33533d924",
|
||||
"sha256:a59e9923cbce7068792f75344ed7727021ee4ac20f227cf17297d0d03d141e91"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==1.9.1"
|
||||
},
|
||||
"djangorestframework": {
|
||||
"hashes": [
|
||||
"sha256:05809fc66e1c997fd9a32ea5730d9f4ba28b109b9da71fccfa5ff241201fd0a4",
|
||||
"sha256:e782087823c47a26826ee5b6fa0c542968219263fb3976ec3c31edab23a4001f"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==3.11.0"
|
||||
},
|
||||
"docutils": {
|
||||
"hashes": [
|
||||
"sha256:6c4f696463b79f1fb8ba0c594b63840ebd41f059e92b31957c46b74a4599b6d0",
|
||||
"sha256:9e4d7ecfc600058e07ba661411a2b7de2fd0fafa17d1a7f7361cd47b1175c827",
|
||||
"sha256:a2aeea129088da402665e92e0b25b04b073c04b2dce4ab65caaa38b7ce2e1a99"
|
||||
],
|
||||
"version": "==0.15.2"
|
||||
},
|
||||
"factory-boy": {
|
||||
"hashes": [
|
||||
"sha256:728df59b372c9588b83153facf26d3d28947fc750e8e3c95cefa9bed0e6394ee",
|
||||
"sha256:faf48d608a1735f0d0a3c9cbf536d64f9132b547dae7ba452c4d99a79e84a370"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==2.12.0"
|
||||
},
|
||||
"faker": {
|
||||
"hashes": [
|
||||
"sha256:440d68fe0e46c1658b1975b2497abe0c24a7f772e3892253f31e713ffcc48965",
|
||||
"sha256:ee24608768549c2c69e593e9d7a3b53c9498ae735534243ec8390cae5d529f8b"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==4.0.1"
|
||||
},
|
||||
"google-api-python-client": {
|
||||
"hashes": [
|
||||
"sha256:3121d55d106ef1a2756e8074239512055bd99eb44da417b3dd680f9a1385adec",
|
||||
"sha256:a8a88174f66d92aed7ebbd73744c2c319b4b1ce828e565f9ec721352d2e2fb8c"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==1.7.11"
|
||||
},
|
||||
"google-auth": {
|
||||
"hashes": [
|
||||
"sha256:1ee22e22f35d6e00f068d7b3999b2ce24ecb5d0dcbd485aa6896d2b83c8907d6",
|
||||
"sha256:28a848d47c55075a0f29d7e26b7a213515c137ab8f0670e546e46d1277060e47"
|
||||
],
|
||||
"version": "==1.11.2"
|
||||
},
|
||||
"google-auth-httplib2": {
|
||||
"hashes": [
|
||||
"sha256:098fade613c25b4527b2c08fa42d11f3c2037dda8995d86de0745228e965d445",
|
||||
"sha256:f1c437842155680cf9918df9bc51c1182fda41feef88c34004bd1978c8157e08"
|
||||
],
|
||||
"version": "==0.0.3"
|
||||
},
|
||||
"gunicorn": {
|
||||
"hashes": [
|
||||
"sha256:1904bb2b8a43658807108d59c3f3d56c2b6121a701161de0ddf9ad140073c626",
|
||||
"sha256:cd4a810dd51bf497552cf3f863b575dabd73d6ad6a91075b65936b151cbf4f9c"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==20.0.4"
|
||||
},
|
||||
"httplib2": {
|
||||
"hashes": [
|
||||
"sha256:79751cc040229ec896aa01dced54de0cd0bf042f928e84d5761294422dde4454",
|
||||
"sha256:de96d0a49f46d0ee7e0aae80141d37b8fcd6a68fb05d02e0b82c128592dd8261"
|
||||
],
|
||||
"version": "==0.17.0"
|
||||
},
|
||||
"idna": {
|
||||
"hashes": [
|
||||
"sha256:7588d1c14ae4c77d74036e8c22ff447b26d0fde8f007354fd48a7814db15b7cb",
|
||||
"sha256:a068a21ceac8a4d63dbfd964670474107f541babbd2250d61922f029858365fa"
|
||||
],
|
||||
"version": "==2.9"
|
||||
},
|
||||
"jmespath": {
|
||||
"hashes": [
|
||||
"sha256:695cb76fa78a10663425d5b73ddc5714eb711157e52704d69be03b1a02ba4fec",
|
||||
"sha256:cca55c8d153173e21baa59983015ad0daf603f9cb799904ff057bfb8ff8dc2d9"
|
||||
],
|
||||
"version": "==0.9.5"
|
||||
},
|
||||
"oauth2client": {
|
||||
"hashes": [
|
||||
"sha256:b8a81cc5d60e2d364f0b1b98f958dbd472887acaf1a5b05e21c28c31a2d6d3ac",
|
||||
"sha256:d486741e451287f69568a4d26d70d9acd73a2bbfa275746c535b4209891cccc6"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==4.1.3"
|
||||
},
|
||||
"oauthlib": {
|
||||
"hashes": [
|
||||
"sha256:bee41cc35fcca6e988463cacc3bcb8a96224f470ca547e697b604cc697b2f889",
|
||||
"sha256:df884cd6cbe20e32633f1db1072e9356f53638e4361bef4e8b03c9127c9328ea"
|
||||
],
|
||||
"version": "==3.1.0"
|
||||
},
|
||||
"pillow": {
|
||||
"hashes": [
|
||||
"sha256:0a628977ac2e01ca96aaae247ec2bd38e729631ddf2221b4b715446fd45505be",
|
||||
"sha256:4d9ed9a64095e031435af120d3c910148067087541131e82b3e8db302f4c8946",
|
||||
"sha256:54ebae163e8412aff0b9df1e88adab65788f5f5b58e625dc5c7f51eaf14a6837",
|
||||
"sha256:5bfef0b1cdde9f33881c913af14e43db69815c7e8df429ceda4c70a5e529210f",
|
||||
"sha256:5f3546ceb08089cedb9e8ff7e3f6a7042bb5b37c2a95d392fb027c3e53a2da00",
|
||||
"sha256:5f7ae9126d16194f114435ebb79cc536b5682002a4fa57fa7bb2cbcde65f2f4d",
|
||||
"sha256:62a889aeb0a79e50ecf5af272e9e3c164148f4bd9636cc6bcfa182a52c8b0533",
|
||||
"sha256:7406f5a9b2fd966e79e6abdaf700585a4522e98d6559ce37fc52e5c955fade0a",
|
||||
"sha256:8453f914f4e5a3d828281a6628cf517832abfa13ff50679a4848926dac7c0358",
|
||||
"sha256:87269cc6ce1e3dee11f23fa515e4249ae678dbbe2704598a51cee76c52e19cda",
|
||||
"sha256:875358310ed7abd5320f21dd97351d62de4929b0426cdb1eaa904b64ac36b435",
|
||||
"sha256:8ac6ce7ff3892e5deaab7abaec763538ffd011f74dc1801d93d3c5fc541feee2",
|
||||
"sha256:91b710e3353aea6fc758cdb7136d9bbdcb26b53cefe43e2cba953ac3ee1d3313",
|
||||
"sha256:9d2ba4ed13af381233e2d810ff3bab84ef9f18430a9b336ab69eaf3cd24299ff",
|
||||
"sha256:a62ec5e13e227399be73303ff301f2865bf68657d15ea50b038d25fc41097317",
|
||||
"sha256:ab76e5580b0ed647a8d8d2d2daee170e8e9f8aad225ede314f684e297e3643c2",
|
||||
"sha256:bf4003aa538af3f4205c5fac56eacaa67a6dd81e454ffd9e9f055fff9f1bc614",
|
||||
"sha256:bf598d2e37cf8edb1a2f26ed3fb255191f5232badea4003c16301cb94ac5bdd0",
|
||||
"sha256:c18f70dc27cc5d236f10e7834236aff60aadc71346a5bc1f4f83a4b3abee6386",
|
||||
"sha256:c5ed816632204a2fc9486d784d8e0d0ae754347aba99c811458d69fcdfd2a2f9",
|
||||
"sha256:dc058b7833184970d1248135b8b0ab702e6daa833be14035179f2acb78ff5636",
|
||||
"sha256:ff3797f2f16bf9d17d53257612da84dd0758db33935777149b3334c01ff68865"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==7.0.0"
|
||||
},
|
||||
"psycopg2-binary": {
|
||||
"hashes": [
|
||||
"sha256:040234f8a4a8dfd692662a8308d78f63f31a97e1c42d2480e5e6810c48966a29",
|
||||
"sha256:086f7e89ec85a6704db51f68f0dcae432eff9300809723a6e8782c41c2f48e03",
|
||||
"sha256:18ca813fdb17bc1db73fe61b196b05dd1ca2165b884dd5ec5568877cabf9b039",
|
||||
"sha256:19dc39616850342a2a6db70559af55b22955f86667b5f652f40c0e99253d9881",
|
||||
"sha256:2166e770cb98f02ed5ee2b0b569d40db26788e0bf2ec3ae1a0d864ea6f1d8309",
|
||||
"sha256:3a2522b1d9178575acee4adf8fd9f979f9c0449b00b4164bb63c3475ea6528ed",
|
||||
"sha256:3aa773580f85a28ffdf6f862e59cb5a3cc7ef6885121f2de3fca8d6ada4dbf3b",
|
||||
"sha256:3b5deaa3ee7180585a296af33e14c9b18c218d148e735c7accf78130765a47e3",
|
||||
"sha256:407af6d7e46593415f216c7f56ba087a9a42bd6dc2ecb86028760aa45b802bd7",
|
||||
"sha256:4c3c09fb674401f630626310bcaf6cd6285daf0d5e4c26d6e55ca26a2734e39b",
|
||||
"sha256:4c6717962247445b4f9e21c962ea61d2e884fc17df5ddf5e35863b016f8a1f03",
|
||||
"sha256:50446fae5681fc99f87e505d4e77c9407e683ab60c555ec302f9ac9bffa61103",
|
||||
"sha256:5057669b6a66aa9ca118a2a860159f0ee3acf837eda937bdd2a64f3431361a2d",
|
||||
"sha256:5dd90c5438b4f935c9d01fcbad3620253da89d19c1f5fca9158646407ed7df35",
|
||||
"sha256:659c815b5b8e2a55193ede2795c1e2349b8011497310bb936da7d4745652823b",
|
||||
"sha256:69b13fdf12878b10dc6003acc8d0abf3ad93e79813fd5f3812497c1c9fb9be49",
|
||||
"sha256:7a1cb80e35e1ccea3e11a48afe65d38744a0e0bde88795cc56a4d05b6e4f9d70",
|
||||
"sha256:7e6e3c52e6732c219c07bd97fff6c088f8df4dae3b79752ee3a817e6f32e177e",
|
||||
"sha256:7f42a8490c4fe854325504ce7a6e4796b207960dabb2cbafe3c3959cb00d1d7e",
|
||||
"sha256:84156313f258eafff716b2961644a4483a9be44a5d43551d554844d15d4d224e",
|
||||
"sha256:8578d6b8192e4c805e85f187bc530d0f52ba86c39172e61cd51f68fddd648103",
|
||||
"sha256:890167d5091279a27e2505ff0e1fb273f8c48c41d35c5b92adbf4af80e6b2ed6",
|
||||
"sha256:98e10634792ac0e9e7a92a76b4991b44c2325d3e7798270a808407355e7bb0a1",
|
||||
"sha256:9aadff9032e967865f9778485571e93908d27dab21d0fdfdec0ca779bb6f8ad9",
|
||||
"sha256:9f24f383a298a0c0f9b3113b982e21751a8ecde6615494a3f1470eb4a9d70e9e",
|
||||
"sha256:a73021b44813b5c84eda4a3af5826dd72356a900bac9bd9dd1f0f81ee1c22c2f",
|
||||
"sha256:afd96845e12638d2c44d213d4810a08f4dc4a563f9a98204b7428e567014b1cd",
|
||||
"sha256:b73ddf033d8cd4cc9dfed6324b1ad2a89ba52c410ef6877998422fcb9c23e3a8",
|
||||
"sha256:b8f490f5fad1767a1331df1259763b3bad7d7af12a75b950c2843ba319b2415f",
|
||||
"sha256:dbc5cd56fff1a6152ca59445178652756f4e509f672e49ccdf3d79c1043113a4",
|
||||
"sha256:eac8a3499754790187bb00574ab980df13e754777d346f85e0ff6df929bcd964",
|
||||
"sha256:eaed1c65f461a959284649e37b5051224f4db6ebdc84e40b5e65f2986f101a08"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==2.8.4"
|
||||
},
|
||||
"pyasn1": {
|
||||
"hashes": [
|
||||
"sha256:39c7e2ec30515947ff4e87fb6f456dfc6e84857d34be479c9d4a4ba4bf46aa5d",
|
||||
"sha256:aef77c9fb94a3ac588e87841208bdec464471d9871bd5050a287cc9a475cd0ba"
|
||||
],
|
||||
"version": "==0.4.8"
|
||||
},
|
||||
"pyasn1-modules": {
|
||||
"hashes": [
|
||||
"sha256:905f84c712230b2c592c19470d3ca8d552de726050d1d1716282a1f6146be65e",
|
||||
"sha256:a50b808ffeb97cb3601dd25981f6b016cbb3d31fbf57a8b8a87428e6158d0c74"
|
||||
],
|
||||
"version": "==0.2.8"
|
||||
},
|
||||
"python-dateutil": {
|
||||
"hashes": [
|
||||
"sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c",
|
||||
"sha256:75bb3f31ea686f1197762692a9ee6a7550b59fc6ca3a1f4b5d7e32fb98e2da2a"
|
||||
],
|
||||
"version": "==2.8.1"
|
||||
},
|
||||
"python3-openid": {
|
||||
"hashes": [
|
||||
"sha256:0086da6b6ef3161cfe50fb1ee5cceaf2cda1700019fda03c2c5c440ca6abe4fa",
|
||||
"sha256:628d365d687e12da12d02c6691170f4451db28d6d68d050007e4a40065868502"
|
||||
],
|
||||
"version": "==3.1.0"
|
||||
},
|
||||
"pytz": {
|
||||
"hashes": [
|
||||
"sha256:1c557d7d0e871de1f5ccd5833f60fb2550652da6be2693c1e02300743d21500d",
|
||||
"sha256:b02c06db6cf09c12dd25137e563b31700d3b80fcc4ad23abb7a315f2789819be"
|
||||
],
|
||||
"version": "==2019.3"
|
||||
},
|
||||
"requests": {
|
||||
"hashes": [
|
||||
"sha256:43999036bfa82904b6af1d99e4882b560e5e2c68e5c4b0aa03b655f3d7d73fee",
|
||||
"sha256:b3f43d496c6daba4493e7c431722aeb7dbc6288f52a6e04e7b6023b0247817e6"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==2.23.0"
|
||||
},
|
||||
"requests-oauthlib": {
|
||||
"hashes": [
|
||||
"sha256:7f71572defaecd16372f9006f33c2ec8c077c3cfa6f5911a9a90202beb513f3d",
|
||||
"sha256:b4261601a71fd721a8bd6d7aa1cc1d6a8a93b4a9f5e96626f8e4d91e8beeaa6a"
|
||||
],
|
||||
"version": "==1.3.0"
|
||||
},
|
||||
"rsa": {
|
||||
"hashes": [
|
||||
"sha256:14ba45700ff1ec9eeb206a2ce76b32814958a98e372006c8fb76ba820211be66",
|
||||
"sha256:1a836406405730121ae9823e19c6e806c62bbad73f890574fff50efa4122c487"
|
||||
],
|
||||
"version": "==4.0"
|
||||
},
|
||||
"s3transfer": {
|
||||
"hashes": [
|
||||
"sha256:2482b4259524933a022d59da830f51bd746db62f047d6eb213f2f8855dcb8a13",
|
||||
"sha256:921a37e2aefc64145e7b73d50c71bb4f26f46e4c9f414dc648c6245ff92cf7db"
|
||||
],
|
||||
"version": "==0.3.3"
|
||||
},
|
||||
"six": {
|
||||
"hashes": [
|
||||
"sha256:236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a",
|
||||
"sha256:8f3cd2e254d8f793e7f3d6d9df77b92252b52637291d0f0da013c76ea2724b6c"
|
||||
],
|
||||
"version": "==1.14.0"
|
||||
},
|
||||
"sqlparse": {
|
||||
"hashes": [
|
||||
"sha256:022fb9c87b524d1f7862b3037e541f68597a730a8843245c349fc93e1643dc4e",
|
||||
"sha256:e162203737712307dfe78860cc56c8da8a852ab2ee33750e33aeadf38d12c548"
|
||||
],
|
||||
"version": "==0.3.1"
|
||||
},
|
||||
"text-unidecode": {
|
||||
"hashes": [
|
||||
"sha256:1311f10e8b895935241623731c2ba64f4c455287888b18189350b67134a822e8",
|
||||
"sha256:bad6603bb14d279193107714b288be206cac565dfa49aa5b105294dd5c4aab93"
|
||||
],
|
||||
"version": "==1.3"
|
||||
},
|
||||
"uritemplate": {
|
||||
"hashes": [
|
||||
"sha256:07620c3f3f8eed1f12600845892b0e036a2420acf513c53f7de0abd911a5894f",
|
||||
"sha256:5af8ad10cec94f215e3f48112de2022e1d5a37ed427fbd88652fa908f2ab7cae"
|
||||
],
|
||||
"version": "==3.0.1"
|
||||
},
|
||||
"urllib3": {
|
||||
"hashes": [
|
||||
"sha256:2f3db8b19923a873b3e5256dc9c2dedfa883e33d87c690d9c7913e1f40673cdc",
|
||||
"sha256:87716c2d2a7121198ebcb7ce7cccf6ce5e9ba539041cfbaeecfb641dc0bf6acc"
|
||||
],
|
||||
"markers": "python_version != '3.4'",
|
||||
"version": "==1.25.8"
|
||||
},
|
||||
"whitenoise": {
|
||||
"hashes": [
|
||||
"sha256:0f9137f74bd95fa54329ace88d8dc695fbe895369a632e35f7a136e003e41d73",
|
||||
"sha256:62556265ec1011bd87113fb81b7516f52688887b7a010ee899ff1fd18fd22700"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==5.0.1"
|
||||
}
|
||||
},
|
||||
"develop": {
|
||||
"autoflake": {
|
||||
"hashes": [
|
||||
"sha256:680cb9dade101ed647488238ccb8b8bfb4369b53d58ba2c8cdf7d5d54e01f95b"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==1.3.1"
|
||||
},
|
||||
"docutils": {
|
||||
"hashes": [
|
||||
"sha256:6c4f696463b79f1fb8ba0c594b63840ebd41f059e92b31957c46b74a4599b6d0",
|
||||
"sha256:9e4d7ecfc600058e07ba661411a2b7de2fd0fafa17d1a7f7361cd47b1175c827",
|
||||
"sha256:a2aeea129088da402665e92e0b25b04b073c04b2dce4ab65caaa38b7ce2e1a99"
|
||||
],
|
||||
"version": "==0.15.2"
|
||||
},
|
||||
"entrypoints": {
|
||||
"hashes": [
|
||||
"sha256:589f874b313739ad35be6e0cd7efde2a4e9b6fea91edcc34e58ecbb8dbe56d19",
|
||||
"sha256:c70dd71abe5a8c85e55e12c19bd91ccfeec11a6e99044204511f9ed547d48451"
|
||||
],
|
||||
"version": "==0.3"
|
||||
},
|
||||
"flake8": {
|
||||
"hashes": [
|
||||
"sha256:45681a117ecc81e870cbf1262835ae4af5e7a8b08e40b944a8a6e6b895914cfb",
|
||||
"sha256:49356e766643ad15072a789a20915d3c91dc89fd313ccd71802303fd67e4deca"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==3.7.9"
|
||||
},
|
||||
"mccabe": {
|
||||
"hashes": [
|
||||
"sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42",
|
||||
"sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"
|
||||
],
|
||||
"version": "==0.6.1"
|
||||
},
|
||||
"pycodestyle": {
|
||||
"hashes": [
|
||||
"sha256:95a2219d12372f05704562a14ec30bc76b05a5b297b21a5dfe3f6fac3491ae56",
|
||||
"sha256:e40a936c9a450ad81df37f549d676d127b1b66000a6c500caa2b085bc0ca976c"
|
||||
],
|
||||
"version": "==2.5.0"
|
||||
},
|
||||
"pyflakes": {
|
||||
"hashes": [
|
||||
"sha256:17dbeb2e3f4d772725c777fabc446d5634d1038f234e77343108ce445ea69ce0",
|
||||
"sha256:d976835886f8c5b31d47970ed689944a0262b5f3afa00a5a7b4dc81e5449f8a2"
|
||||
],
|
||||
"version": "==2.1.1"
|
||||
}
|
||||
}
|
||||
}
|
127
README.md
127
README.md
|
@ -26,7 +26,7 @@ All API routes are prefixed with `/api/pulse/`. The "pulse" might seem redundant
|
|||
# Developer information
|
||||
|
||||
- [Getting up and running for local development](#getting-up-and-running-for-local-development)
|
||||
- [Pipenv and Invoke](#pipenv-and-invoke)
|
||||
- [Local development documentation](#local-development)
|
||||
- [Environment variables](#environment-variables)
|
||||
- [Deploying to Heroku](#deploying-to-heroku)
|
||||
- [Debugging](#debugging-all-the-things)
|
||||
|
@ -699,16 +699,15 @@ Replies with an Atom feed consisting of (a subset of) only those entries that ar
|
|||
|
||||
## Setup
|
||||
|
||||
**Requirements**: [python3.6](https://www.python.org/), [pip](https://pypi.python.org/pypi), [pipenv](https://docs.pipenv.org/), [invoke](http://www.pyinvoke.org/installing.html).
|
||||
**Requirements**: [python3.7](https://www.python.org/), [invoke](http://www.pyinvoke.org/installing.html).
|
||||
|
||||
1. Clone this repo: `git clone https://github.com/mozilla/network-pulse-api.git`
|
||||
2. Run `inv setup`
|
||||
3. If you only want to use Django Admin login, your setup is done.
|
||||
4. To enable Google and/or GitHub login, follow the [instructions below](#setting-up-social-authentication).
|
||||
- Install [Invoke](http://www.pyinvoke.org/installing.html) using [pipx](https://pypi.org/project/pipx/).
|
||||
- Run `inv setup`.
|
||||
- Start your server with `inv runserver`.
|
||||
- To enable Google and/or GitHub login, follow the [instructions below](#setting-up-social-authentication).
|
||||
|
||||
**If you're on Windows:** you will need to Create a super user by running `pipenv run python manage.py createsuperuser`
|
||||
|
||||
`inv setup` takes care of installing the project's dependencies, copying environment variables, creating a superuser when possible and generating fake data. When it's done, follow the instructions. To start your local server, run `inv runserver`.
|
||||
Update your branch by doing a git pull and `inv catchup`.
|
||||
When switching branches, get a new virtualenv and database by running `inv new-env`.
|
||||
|
||||
You can get a full list of inv commands by running `inv -l`.
|
||||
|
||||
|
@ -770,9 +769,9 @@ If it is set to `False`, you are required to use [Mailgun](https://www.mailgun.c
|
|||
|
||||
Fake model data can be loaded into your dev site with the following command:
|
||||
|
||||
- `pipenv run python manage.py load_fake_data`
|
||||
- `inv manage load_fake_data`
|
||||
|
||||
`pipenv run python manage.py load_fake_data -e 30` will run the full `load_fake_data` script, but changes the number of entries per variations to 30 instead of 20.
|
||||
`inv manage "load_fake_data -e 30"` will run the full `load_fake_data` script, but changes the number of entries per variations to 30 instead of 20.
|
||||
|
||||
Options available:
|
||||
|
||||
|
@ -783,75 +782,67 @@ Options available:
|
|||
- `-e`, `--entries-count`: The number of entries to generate per possible variations. Default: 20, variations: 16
|
||||
- `-t`, `--tags-count`: The number of tags to generate. Default: 6
|
||||
|
||||
## Pipenv and Invoke
|
||||
## Local development
|
||||
|
||||
This project doesn't use a `requirements.txt` file, but `Pipfile` and `Pipfile.lock` files, managed by Pipenv. It also uses a set of Invoke tasks to provide shortcuts for commonly used commands.
|
||||
### How to use
|
||||
|
||||
### Using pipenv
|
||||
- Install [Invoke](http://www.pyinvoke.org/installing.html) using [pipx](https://pypi.org/project/pipx/).
|
||||
- Run `inv setup`.
|
||||
- Start your server with `inv runserver`.
|
||||
|
||||
Checking [Pipenv's documentation](https://docs.pipenv.org/) is highly recommended if you're new to it.
|
||||
|
||||
#### Running commands
|
||||
|
||||
The general syntax is:
|
||||
|
||||
- `pipenv run python [COMMAND]`. For example: `pipenv run python manage.py runserver`
|
||||
|
||||
#### Installing dependencies
|
||||
|
||||
- `pipenv install [package name]`
|
||||
|
||||
After installing a package, pipenv automatically runs a `pipenv lock` that updates the `pipfile.lock`. You need to add both `pipfile` and `pipfile.lock` to your commit.
|
||||
|
||||
#### Updating dependencies
|
||||
|
||||
- `pipenv check` to check security vulnerabilities,
|
||||
- `pipenv update --outdated` to list dependencies that need to be updated,
|
||||
- `pipenv update` to update dependencies
|
||||
|
||||
If a dependency is updated, pipenv automatically runs a `pipenv lock` that updates the `pipfile.lock`. You need to add both `pipfile` and `pipfile.lock` to your commit.
|
||||
|
||||
#### Listing installed dependencies
|
||||
|
||||
- `pipenv graph`
|
||||
|
||||
#### Virtual environment
|
||||
|
||||
- `pipenv shell` activates your virtual environment and automatically loads your `.env`. Run `exit` to leave it. **You don't need to be in your virtual environment to run python commands:** Use `pipenv run python [COMMAND]` instead.
|
||||
|
||||
#### Known issues
|
||||
|
||||
If you run `pipenv run python manage.py runserver` but get a `Cross-Origin Request Blocked` in the front, deactivate the auto-loading of the `.env`. ex: `PIPENV_DONT_LOAD_ENV=1 pipenv run ./manage.py runserver`
|
||||
|
||||
The reason behind this is that our CORS withelist regex is messed up by [a bug in python-dotenv](https://github.com/theskumar/python-dotenv/issues/112).
|
||||
Update your branch by doing a git pull and `inv catchup`.
|
||||
When switching branches, get a new virtualenv and database by running `inv new-env`.
|
||||
|
||||
### Using invoke
|
||||
|
||||
Invoke is a task execution tool. Instead of running `pipenv run python manage.py runserver`, you can run `inv
|
||||
Invoke is a task execution tool. Instead of running `./pulsevenv/bin/python manage.py runserver`, you can run `inv
|
||||
runserver`.
|
||||
|
||||
Available tasks:
|
||||
- `inv -l`: list available invoke tasks
|
||||
- `inv makemigrations`: Creates new migration(s) for apps
|
||||
- `inv migrate`: Updates database schema
|
||||
- `inv runserver`: Start a web server
|
||||
- `inv setup`: Automate project's configuration and dependencies installation
|
||||
- `inv catch-up`: Install dependencies and apply migrations
|
||||
- `inv test`: Run tests and linter
|
||||
```
|
||||
catch-up (catchup) Install dependencies and apply migrations
|
||||
makemigrations Creates new migration(s) for apps
|
||||
manage Shorthand to manage.py. inv docker-manage "[COMMAND] [ARG]"
|
||||
migrate Updates database schema
|
||||
new-db Create a new database with fake data
|
||||
pip-compile (docker-pip-compile) Shorthand to pip-tools. inv pip-compile "[COMMAND] [ARG]"
|
||||
pip-compile-lock (docker-pip-compile-lock) Lock prod and dev dependencies
|
||||
pip-sync (docker-pip-sync) Sync your python virtualenv
|
||||
runserver Start a web server
|
||||
setup (new-env) Automate project's configuration and dependencies installation
|
||||
test Run tests
|
||||
```
|
||||
|
||||
For management commands not covered by an invoke tasks, use `inv manage [command]` (example: `inv manage load_fake_data`). You can pass flag and options to management commands using `inv manage [command] -o [positional argument] -f [optional argument]`. For example:
|
||||
- `inv manage runserver -o 3000`
|
||||
- `inv manage load_fake_data -f seed=VALUE`
|
||||
- `inv manage migrate -o news`
|
||||
### How to install or update dependencies?
|
||||
|
||||
**Note on [pip-tools](https://github.com/jazzband/pip-tools)**:
|
||||
- Only edit the `.in` files and use `invoke pip-compile-lock` to generate `.txt` files.
|
||||
- Both `(dev-)requirements.txt` and `(dev-)requirements.in` files need to be pushed to Github.
|
||||
- `.txt` files act as lockfiles, where dependencies are pinned to a precise version.
|
||||
|
||||
Dependencies live on your filesystem: you don't need to rebuild the `backend` image when installing or updating dependencies.
|
||||
|
||||
**Install packages:**
|
||||
|
||||
- Modify the `requirements.in` or `dev-requirements.in` to add the dependency you want to install.
|
||||
- Run `invoke pip-compile-lock`.
|
||||
- Run `invoke pip-sync`.
|
||||
|
||||
**Update packages:**
|
||||
|
||||
- `invoke pip-compile "-upgrade (dev-)requirements.in"`: update all (the dev) dependencies.
|
||||
- `invoke pip-compile "--upgrade-package [PACKAGE](==x.x.x)"`: update the specified dependency. To update multiple dependencies, you always need to add the `-P` flag.
|
||||
|
||||
When it's done, run `inv pip-sync`.
|
||||
|
||||
### Nix-shell
|
||||
|
||||
If you want to use nix-shell to isolate your dev environment:
|
||||
|
||||
- Install [Nix](https://nixos.org/nix/): `curl https://nixos.org/nix/install | sh`,
|
||||
- In `network-pulse-api` directory, enter `nix-shell`. It will install Python 3.6, pipenv and invoke,
|
||||
- Enter `inv setup` to setup the project,
|
||||
- When it's done, use invoke and pipenv commands as usual.
|
||||
- In `network-pulse-api` directory, enter `nix-shell`. It will install Python 3.7 and invoke.
|
||||
- Enter `inv setup` to setup the project.
|
||||
- When it's done, use invoke commands as usual.
|
||||
|
||||
If you want to use another shell instead of bash, use `nix-shell --command SHELL` (`nix-shell --command zsh` for example).
|
||||
|
||||
|
@ -859,7 +850,7 @@ If you want to use another shell instead of bash, use `nix-shell --command SHELL
|
|||
[Direnv](https://direnv.net/) will load your `nix-shell` automatically when you enter the `network-pulse-api` directory.
|
||||
|
||||
To use it:
|
||||
- Follow the instruction to [install direnv](https://direnv.net/) on your system,
|
||||
- Follow the instruction to [install direnv](https://direnv.net/) on your system.
|
||||
- Allow direnv to auto-load your nix-shell by entering `direnv allow .` in the `network-pulse-api` directory.
|
||||
|
||||
|
||||
|
@ -969,13 +960,13 @@ You may have noticed that when running with `DEBUG=TRUE`, there is a debugger to
|
|||
|
||||
When working across multiple branches with multiple model changes, it sometimes becomes necessary to reset migrations and build a new database from scratch. You can either do this manually by deleting your `db.sqlite3` as well as all model migration files that start with a number (**except** for the 0001 migration for `issues`, which instantiates various records in addition to boostrapping the issues table, and should never be deleted), but because this is inconvenient, there is a helper script to do this for you.
|
||||
|
||||
run `pipenv run python reset_database.py` and the steps mentioned above will be run automatically.
|
||||
run `pulsevenv/bin/python reset_database.py` and the steps mentioned above will be run automatically.
|
||||
|
||||
**Note:** This does wipe *everything* so you will still need to call `pipenv run python manage.py createsuperuser` afterwards to make sure you have a super user set up again.
|
||||
**Note:** This does wipe *everything* so you will still need to call `pulsevenv/bin/python manage.py createsuperuser` afterwards to make sure you have a super user set up again.
|
||||
|
||||
## Migrating data from Google sheets
|
||||
|
||||
To migrate data, export JSON from the Google Sheets db, and save it in the root directory as `migrationData.json`. Then run `pipenv run python migrate.py`. This generates `massagedData.json`.
|
||||
To migrate data, export JSON from the Google Sheets db, and save it in the root directory as `migrationData.json`. Then run `pulsevenv/bin/python migrate.py`. This generates `massagedData.json`.
|
||||
In `public/migrate.html`, update the endpoint to be the address of the one you're trying to migrate data into. If it's a local db, leave as is.
|
||||
Spin up a server from the `public` folder on port 8080. Log in to your API using Oauth (either the hosted site or `test.example.com:8000` if doing this locally)
|
||||
Visit `http://test.example.com:8080/migrate.html`, paste the contents of `massagedData.json`, and submit. It will process the entire array of entries one at a time, POSTing them to the server. Check your developer console and network requests if it doesn't complete after a minute or two.
|
||||
|
|
13
appveyor.yml
13
appveyor.yml
|
@ -27,10 +27,11 @@ init:
|
|||
- "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%"
|
||||
|
||||
install:
|
||||
- "SET PYTHONPATH=%APPVEYOR_BUILD_FOLDER%"
|
||||
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
|
||||
- "python -m pip install --upgrade pip"
|
||||
- "python -m pip install pipenv"
|
||||
- "python -m pipenv install --dev --deploy"
|
||||
- "python -m venv venv"
|
||||
- ".\\venv\\Scripts\\activate"
|
||||
- "pip install -r requirements.txt -r dev-requirements.txt"
|
||||
|
||||
services:
|
||||
- postgresql
|
||||
|
@ -40,11 +41,11 @@ before_test:
|
|||
- SET PGPASSWORD=Password12!
|
||||
- PATH=C:\Program Files\PostgreSQL\9.6\bin\;%PATH%
|
||||
- createdb pulseapi
|
||||
- "python -m pipenv run python manage.py migrate"
|
||||
- "python manage.py migrate"
|
||||
|
||||
test_script:
|
||||
- "python -m pipenv run flake8 pulseapi --config=./pulseapi/tox.ini"
|
||||
- "python -m pipenv run python manage.py test"
|
||||
- "flake8 pulseapi"
|
||||
- "python manage.py test"
|
||||
|
||||
cache:
|
||||
- "%LOCALAPPDATA%\\pip\\Cache"
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
-c requirements.txt
|
||||
autoflake
|
||||
docutils
|
||||
flake8
|
|
@ -0,0 +1,14 @@
|
|||
#
|
||||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile dev-requirements.in
|
||||
#
|
||||
autoflake==1.3.1 # via -r dev-requirements.in
|
||||
docutils==0.15.2 # via -c requirements.txt, -r dev-requirements.in
|
||||
flake8==3.8.1 # via -r dev-requirements.in
|
||||
importlib-metadata==1.6.0 # via flake8
|
||||
mccabe==0.6.1 # via flake8
|
||||
pycodestyle==2.6.0 # via flake8
|
||||
pyflakes==2.2.0 # via autoflake, flake8
|
||||
zipp==3.1.0 # via importlib-metadata
|
|
@ -0,0 +1,2 @@
|
|||
run:
|
||||
echo: true
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"name": "network-pulse-api",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1
|
||||
}
|
21
package.json
21
package.json
|
@ -1,21 +0,0 @@
|
|||
{
|
||||
"name": "network-pulse-api",
|
||||
"version": "1.0.0",
|
||||
"description": "Network Pulse API",
|
||||
"scripts": {
|
||||
"install": "pipenv install --dev",
|
||||
"start": "pipenv run python manage.py runserver",
|
||||
"test": "pipenv run python manage.py test",
|
||||
"flake8": "pipenv run flake8 pulseapi"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/mozilla/network-pulse-api.git"
|
||||
},
|
||||
"author": "Mozilla Foundation",
|
||||
"license": "MPL-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/mozilla/network-pulse-api/issues"
|
||||
},
|
||||
"homepage": "https://github.com/mozilla/network-pulse-api#readme"
|
||||
}
|
|
@ -33,6 +33,7 @@ env = environ.Env(
|
|||
CSRF_TRUSTED_ORIGINS=(list, []),
|
||||
DEBUG=(bool, False),
|
||||
DJANGO_LOG_LEVEL=(str, 'INFO'),
|
||||
DATABASE_URL=(str, None),
|
||||
HEROKU_APP_NAME=(str, ''),
|
||||
HEROKU_PR_NUMBER=(str, ''),
|
||||
HEROKU_BRANCH=(str, ''),
|
||||
|
@ -233,9 +234,9 @@ DATABASES = {
|
|||
}
|
||||
}
|
||||
|
||||
DATABASE_URL = os.getenv('DATABASE_URL', False)
|
||||
DATABASE_URL = env('DATABASE_URL')
|
||||
|
||||
if DATABASE_URL is not False:
|
||||
if DATABASE_URL is not None:
|
||||
DATABASES['default'].update(dj_database_url.config())
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
[flake8]
|
||||
exclude =
|
||||
# There's no value in checking cache directories
|
||||
__pycache__,
|
||||
# There's also no value in checking auto-generated files
|
||||
*migrations*
|
||||
max-line-length = 119
|
|
@ -49,8 +49,8 @@ class Command(BaseCommand):
|
|||
except KeyError:
|
||||
pr_title = ''
|
||||
|
||||
for l in r.json()['labels']:
|
||||
if l['name'] == 'dependencies':
|
||||
for label in r.json()['labels']:
|
||||
if label['name'] == 'dependencies':
|
||||
color = '#BA55D3'
|
||||
break
|
||||
else:
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
boto3
|
||||
dj-database-url
|
||||
Django==2.2.12
|
||||
django-cors-headers
|
||||
django-debug-toolbar
|
||||
django-ajax-selects==1.9.1
|
||||
django-environ
|
||||
django-filter==2.2
|
||||
django-storages
|
||||
djangorestframework==3.11.0
|
||||
factory_boy
|
||||
Faker
|
||||
google-api-python-client
|
||||
gunicorn
|
||||
Pillow
|
||||
requests
|
||||
whitenoise
|
||||
psycopg2-binary
|
||||
django-allauth==0.40.0
|
||||
oauth2client
|
|
@ -0,0 +1,57 @@
|
|||
#
|
||||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile
|
||||
#
|
||||
boto3==1.13.11 # via -r requirements.in
|
||||
botocore==1.16.11 # via boto3, s3transfer
|
||||
cachetools==4.1.0 # via google-auth
|
||||
certifi==2020.4.5.1 # via requests
|
||||
chardet==3.0.4 # via requests
|
||||
defusedxml==0.6.0 # via python3-openid
|
||||
dj-database-url==0.5.0 # via -r requirements.in
|
||||
django-ajax-selects==1.9.1 # via -r requirements.in
|
||||
django-allauth==0.40.0 # via -r requirements.in
|
||||
django-cors-headers==3.2.1 # via -r requirements.in
|
||||
django-debug-toolbar==2.2 # via -r requirements.in
|
||||
django-environ==0.4.5 # via -r requirements.in
|
||||
django-filter==2.2 # via -r requirements.in
|
||||
django-storages==1.9.1 # via -r requirements.in
|
||||
django==2.2.12 # via -r requirements.in, django-allauth, django-cors-headers, django-debug-toolbar, django-filter, django-storages, djangorestframework
|
||||
djangorestframework==3.11.0 # via -r requirements.in
|
||||
docutils==0.15.2 # via botocore
|
||||
factory-boy==2.12.0 # via -r requirements.in
|
||||
faker==4.1.0 # via -r requirements.in, factory-boy
|
||||
google-api-core==1.17.0 # via google-api-python-client
|
||||
google-api-python-client==1.8.3 # via -r requirements.in
|
||||
google-auth-httplib2==0.0.3 # via google-api-python-client
|
||||
google-auth==1.14.3 # via google-api-core, google-api-python-client, google-auth-httplib2
|
||||
googleapis-common-protos==1.51.0 # via google-api-core
|
||||
gunicorn==20.0.4 # via -r requirements.in
|
||||
httplib2==0.17.3 # via google-api-python-client, google-auth-httplib2, oauth2client
|
||||
idna==2.9 # via requests
|
||||
jmespath==0.10.0 # via boto3, botocore
|
||||
oauth2client==4.1.3 # via -r requirements.in
|
||||
oauthlib==3.1.0 # via requests-oauthlib
|
||||
pillow==7.1.2 # via -r requirements.in
|
||||
protobuf==3.12.0 # via google-api-core, googleapis-common-protos
|
||||
psycopg2-binary==2.8.5 # via -r requirements.in
|
||||
pyasn1-modules==0.2.8 # via google-auth, oauth2client
|
||||
pyasn1==0.4.8 # via oauth2client, pyasn1-modules, rsa
|
||||
python-dateutil==2.8.1 # via botocore, faker
|
||||
python3-openid==3.1.0 # via django-allauth
|
||||
pytz==2020.1 # via django, google-api-core
|
||||
requests-oauthlib==1.3.0 # via django-allauth
|
||||
requests==2.23.0 # via -r requirements.in, django-allauth, google-api-core, requests-oauthlib
|
||||
rsa==4.0 # via google-auth, oauth2client
|
||||
s3transfer==0.3.3 # via boto3
|
||||
six==1.14.0 # via django-ajax-selects, google-api-core, google-api-python-client, google-auth, oauth2client, protobuf, python-dateutil
|
||||
sqlparse==0.3.1 # via django, django-debug-toolbar
|
||||
text-unidecode==1.3 # via faker
|
||||
uritemplate==3.0.1 # via google-api-python-client
|
||||
urllib3==1.25.9 # via botocore, requests
|
||||
whitenoise==5.0.1 # via -r requirements.in
|
||||
|
||||
# The following packages are considered to be unsafe in a requirements file:
|
||||
# setuptools
|
|
@ -1,6 +1,8 @@
|
|||
DEBUG=True
|
||||
PULSE_FRONTEND_HOSTNAME=localhost:3000
|
||||
SECRET_KEY=BetPHpGoUXUwjaAXm6ArIhV95xLdDZtu8QEGnNXY3eTknIkD
|
||||
DATABASE_URL=postgres://postgres@localhost:5432/pulse
|
||||
ALLOWED_HOSTS=*
|
||||
|
||||
# Security settings
|
||||
CORS_ORIGIN_REGEX_WHITELIST=http://localhost:\d+,http://test.example.com:\d+
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
{ pkgs ? import (fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixpkgs-18.09-darwin.tar.gz) {} }:
|
||||
{ pkgs ? import (fetchTarball channel:nixpkgs-19.03-darwin) {} }:
|
||||
|
||||
# To be replaced when the last version of pipenv is available
|
||||
let pipenv = pkgs.pipenv.overrideAttrs (attrs: {name = "pipenv-2018-10-9"; src = pkgs.python3Packages.fetchPypi { pname = "pipenv"; version = "2018.10.9"; sha256 = "0b0safavjxq6malmv44acmgds21m2sp1wqa7gs0qz621v6gcgq4j";};}); in
|
||||
|
||||
pkgs.mkShell {
|
||||
buildInputs = [ pkgs.python36 pipenv pkgs.python36Packages.invoke];
|
||||
pkgs.mkShell {
|
||||
buildInputs = [ pkgs.python37 pkgs.python37Packages.invoke];
|
||||
}
|
||||
|
|
175
tasks.py
175
tasks.py
|
@ -1,5 +1,5 @@
|
|||
import re
|
||||
from sys import platform
|
||||
from shutil import copy
|
||||
|
||||
from invoke import task
|
||||
|
||||
|
@ -12,21 +12,98 @@ ROOT = os.path.dirname(os.path.realpath(__file__))
|
|||
# Python commands's outputs are not rendering properly. Setting pty for *Nix system and
|
||||
# "PYTHONUNBUFFERED" env var for Windows at True.
|
||||
if platform == 'win32':
|
||||
PLATFORM_ARG = dict(env={'PYTHONUNBUFFERED': 'True', 'PIPENV_DONT_LOAD_ENV': '1'})
|
||||
PLATFORM_ARG = dict(env={'PYTHONUNBUFFERED': 'True'})
|
||||
else:
|
||||
PLATFORM_ARG = dict(pty=True, env={'PIPENV_DONT_LOAD_ENV': '1'})
|
||||
PLATFORM_ARG = dict(pty=True)
|
||||
|
||||
|
||||
@task(optional=['option', 'flag'])
|
||||
def manage(ctx, command, option=None, flag=None):
|
||||
"""Shorthand to manage.py. inv manage [COMMAND] [-o OPTION] [-f FLAG]. ex: inv manage runserver -o 3000"""
|
||||
def create_env_file(env_file):
|
||||
"""Create or update the .env file"""
|
||||
with open(env_file, 'r') as f:
|
||||
env_vars = f.read()
|
||||
# update the DATABASE_URL env
|
||||
new_db_url = "DATABASE_URL=postgres://postgres@localhost:5432/pulse"
|
||||
old_db_url = re.search('DATABASE_URL=.*', env_vars)
|
||||
if old_db_url:
|
||||
env_vars = env_vars.replace(old_db_url.group(0), new_db_url)
|
||||
else:
|
||||
env_vars = env_vars + "DATABASE_URL=postgres://postgres@localhost:5432/pulse\n"
|
||||
|
||||
# update the ALLOWED_HOSTS env
|
||||
new_hosts = "ALLOWED_HOSTS=*"
|
||||
old_hosts = re.search('ALLOWED_HOSTS=.*', env_vars)
|
||||
if old_hosts:
|
||||
env_vars = env_vars.replace(old_hosts.group(0), new_hosts)
|
||||
else:
|
||||
env_vars = env_vars + "ALLOWED_HOSTS=*\n"
|
||||
|
||||
# create the new env file
|
||||
with open('.env', 'w') as f:
|
||||
f.write(env_vars)
|
||||
|
||||
|
||||
def create_super_user(ctx):
|
||||
preamble = "from django.contrib.auth import get_user_model;User = get_user_model();"
|
||||
create = "User.objects.create_superuser('admin', 'admin@mozillafoundation.org', 'admin')"
|
||||
manage(ctx, f'shell -c "{preamble} {create}"')
|
||||
print("\nCreated superuser `admin@mozillafoundation.org` with password `admin`.")
|
||||
|
||||
|
||||
# Project setup and update
|
||||
@task(aliases=["new-env"])
|
||||
def setup(ctx):
|
||||
"""Automate project's configuration and dependencies installation"""
|
||||
with ctx.cd(ROOT):
|
||||
if option:
|
||||
ctx.run(f"pipenv run python manage.py {command} {option}", **PLATFORM_ARG)
|
||||
elif flag:
|
||||
ctx.run(f"pipenv run python manage.py {command} --{flag}", **PLATFORM_ARG)
|
||||
if os.path.isfile(".env"):
|
||||
print("* Updating your .env")
|
||||
create_env_file(".env")
|
||||
else:
|
||||
ctx.run(f"pipenv run python manage.py {command}", **PLATFORM_ARG)
|
||||
print("* Creating a new .env")
|
||||
create_env_file("sample.env")
|
||||
# create virtualenv
|
||||
if not os.path.isfile("./pulsevenv/bin/python"):
|
||||
print("* Creating a Python virtual environment")
|
||||
ctx.run("python3 -m venv pulsevenv")
|
||||
print("* Installing pip-tools")
|
||||
ctx.run("./pulsevenv/bin/pip install pip-tools")
|
||||
# install deps
|
||||
print("* Installing Python dependencies")
|
||||
pip_sync(ctx)
|
||||
new_db(ctx)
|
||||
|
||||
|
||||
@task(aliases=["catchup"])
|
||||
def catch_up(ctx):
|
||||
"""Install dependencies and apply migrations"""
|
||||
print("Installing Python dependencies")
|
||||
pip_sync(ctx)
|
||||
print("Applying database migrations")
|
||||
migrate(ctx)
|
||||
|
||||
|
||||
@task
|
||||
def new_db(ctx):
|
||||
"""Create a new database with fake data"""
|
||||
print("* Reset the database")
|
||||
ctx.run("dropdb --if-exists -h localhost pulse -U postgres")
|
||||
ctx.run("createdb -h localhost pulse -U postgres")
|
||||
print("* Migrating database")
|
||||
migrate(ctx)
|
||||
print("* Creating fake data")
|
||||
manage(ctx, "load_fake_data")
|
||||
create_super_user(ctx)
|
||||
print("* Done!\n"
|
||||
"You can get a full list of inv commands with 'inv -l'\n"
|
||||
"Start you server with 'inv runserver'\n"
|
||||
)
|
||||
|
||||
|
||||
# Django shorthands
|
||||
@task
|
||||
def manage(ctx, command):
|
||||
"""Shorthand to manage.py. inv docker-manage \"[COMMAND] [ARG]\""""
|
||||
with ctx.cd(ROOT):
|
||||
ctx.run(f"./pulsevenv/bin/python manage.py {command}", **PLATFORM_ARG)
|
||||
|
||||
|
||||
@task
|
||||
|
@ -47,58 +124,46 @@ def makemigrations(ctx):
|
|||
manage(ctx, "makemigrations")
|
||||
|
||||
|
||||
# Tests
|
||||
@task
|
||||
def test(ctx):
|
||||
"""Run tests"""
|
||||
print("Running flake8")
|
||||
ctx.run("pipenv run flake8 pulseapi", **PLATFORM_ARG)
|
||||
ctx.run("./pulsevenv/bin/python -m flake8 pulseapi", **PLATFORM_ARG)
|
||||
print("Running tests")
|
||||
manage(ctx, "test")
|
||||
|
||||
|
||||
@task
|
||||
def setup(ctx):
|
||||
"""Automate project's configuration and dependencies installation"""
|
||||
setup_finish_instructions = (
|
||||
"Done!\n"
|
||||
"You can get a full list of inv commands with 'inv -l'\n\n"
|
||||
"If you only want to login with Django admin credentials, your setup is complete and you can run the server using 'inv runserver',\n"
|
||||
"To enable login using Google and/or Github:\n"
|
||||
"1. Set up a Google client here: https://console.developers.google.com/apis/credentials. Optionally also create a Github client here: https://github.com/settings/applications/new.\n The Authorized domain is http://test.example.com:8000 and the redirect url is http://test.example.com:8000/accounts/google/login/callback/ (replace google with github for the github redirect url).\n"
|
||||
"2. Create a superuser by running 'pipenv run python manage.py createsuperuser'\n"
|
||||
"3. When it's done, start your dev server by running 'inv runserver'.\n"
|
||||
"4. Login to the admin interface as a superuser and create an instance each of 'Social Application', one for Google and one for Github with their client ids and secrets filled in.\n"
|
||||
"5. You can now login using Google and/or Github.\n"
|
||||
)
|
||||
# Pip-tools
|
||||
@task(aliases=["docker-pip-compile"])
|
||||
def pip_compile(ctx, command):
|
||||
"""Shorthand to pip-tools. inv pip-compile \"[COMMAND] [ARG]\""""
|
||||
with ctx.cd(ROOT):
|
||||
if os.path.isfile(".env"):
|
||||
print("'.env' file found:\n"
|
||||
"- If you want to completely redo your dev setup, delete your '.env' file and your database. Then "
|
||||
"run 'inv setup' again.\n"
|
||||
"- If you want to catch up with the latest changes, like after a 'git pull', run 'inv catch-up' "
|
||||
"instead.")
|
||||
else:
|
||||
print("Copying default environment variables")
|
||||
copy("sample.env", ".env")
|
||||
print("Installing Python dependencies")
|
||||
ctx.run("pipenv install --dev")
|
||||
print("Applying database migrations")
|
||||
ctx.run("inv migrate")
|
||||
print("Creating fake data")
|
||||
ctx.run("inv manage load_fake_data")
|
||||
# Windows doesn't support pty, skipping createsuperuser step
|
||||
if platform == 'win32':
|
||||
print(setup_finish_instructions)
|
||||
else:
|
||||
print("Creating superuser")
|
||||
ctx.run("pipenv run python manage.py createsuperuser", pty=True)
|
||||
print(setup_finish_instructions)
|
||||
ctx.run(
|
||||
f"./pulsevenv/bin/pip-compile {command}",
|
||||
**PLATFORM_ARG,
|
||||
)
|
||||
|
||||
|
||||
@task()
|
||||
def catch_up(ctx):
|
||||
"""Install dependencies and apply migrations"""
|
||||
print("Installing Python dependencies")
|
||||
ctx.run("pipenv install --dev")
|
||||
print("Applying database migrations")
|
||||
ctx.run("inv migrate")
|
||||
@task(aliases=["docker-pip-compile-lock"])
|
||||
def pip_compile_lock(ctx):
|
||||
"""Lock prod and dev dependencies"""
|
||||
with ctx.cd(ROOT):
|
||||
ctx.run(
|
||||
"./pulsevenv/bin/pip-compile",
|
||||
**PLATFORM_ARG,
|
||||
)
|
||||
ctx.run(
|
||||
"./pulsevenv/bin/pip-compile dev-requirements.in",
|
||||
**PLATFORM_ARG,
|
||||
)
|
||||
|
||||
|
||||
@task(aliases=["docker-pip-sync"])
|
||||
def pip_sync(ctx):
|
||||
"""Sync your python virtualenv"""
|
||||
with ctx.cd(ROOT):
|
||||
ctx.run(
|
||||
"./pulsevenv/bin/pip-sync requirements.txt dev-requirements.txt",
|
||||
**PLATFORM_ARG,
|
||||
)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
[flake8]
|
||||
exclude=
|
||||
*migrations*
|
||||
node_modules
|
||||
max-line-length=119
|
Загрузка…
Ссылка в новой задаче