From 0fd65d3c2b7c7efc72a4a15568cb29f89e71e618 Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Thu, 11 Jan 2018 09:32:45 +1100 Subject: [PATCH] Enable CORS using django-cors-headers --- Pipfile | 1 + Pipfile.lock | 207 +++++++++++++++++------------------- lemoncurry/settings/base.py | 5 + 3 files changed, 103 insertions(+), 110 deletions(-) diff --git a/Pipfile b/Pipfile index eafb52c..0ed3b3c 100644 --- a/Pipfile +++ b/Pipfile @@ -44,6 +44,7 @@ ronkyuu = "*" cachecontrol = "*" hiredis = "*" "mf2util" = "*" +django-cors-headers = "*" [dev-packages] diff --git a/Pipfile.lock b/Pipfile.lock index ca0d511..fa8752f 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,18 +1,18 @@ { "_meta": { "hash": { - "sha256": "89f67ee2a974377da512befef558bc9f3a6508ef6a7e8c69d28cfb3c4e7f64b8" + "sha256": "d0195c40ff7b024deba5cedd5636e319895355ffbe180a3696ad3a1ea3629750" }, "host-environment-markers": { "implementation_name": "cpython", - "implementation_version": "3.6.3", + "implementation_version": "3.6.4", "os_name": "posix", "platform_machine": "x86_64", "platform_python_implementation": "CPython", - "platform_release": "17.3.0", + "platform_release": "17.4.0", "platform_system": "Darwin", - "platform_version": "Darwin Kernel Version 17.3.0: Sun Oct 29 19:57:25 PDT 2017; root:xnu-4570.30.85~19/RELEASE_X86_64", - "python_full_version": "3.6.3", + "platform_version": "Darwin Kernel Version 17.4.0: Tue Dec 19 11:20:50 PST 2017; root:xnu-4570.41.2~2/RELEASE_X86_64", + "python_full_version": "3.6.4", "python_version": "3.6", "sys_platform": "darwin" }, @@ -45,10 +45,10 @@ }, "bleach": { "hashes": [ - "sha256:7a316eac1eef1e98b9813636ebe05878aab1a658d2708047fb00fe2bcbc49f84", - "sha256:760a9368002180fb8a0f4ea48dc6275378e6f311c39d0236d7b904fca1f5ea0d" + "sha256:cf567e7ed30ea5e05b31231d88ae170af1c5544758b9d7bebbc20590b7c30b1e", + "sha256:38fc8cbebea4e787d8db55d6f324820c7f74362b70db9142c1ac7920452d1a19" ], - "version": "==2.1.1" + "version": "==2.1.2" }, "cachecontrol": { "hashes": [ @@ -79,10 +79,10 @@ }, "django": { "hashes": [ - "sha256:75ce405d60f092f6adf904058d023eeea0e6d380f8d9c36134bac73da736023d", - "sha256:8918e392530d8fc6965a56af6504229e7924c27265893f3949aa0529cd1d4b99" + "sha256:52475f607c92035d4ac8fee284f56213065a4a6b25ed43f7e39df0e576e69e9f", + "sha256:d96b804be412a5125a594023ec524a2010a6ffa4d408e5482ab6ff3cb97ec12f" ], - "version": "==1.11.7" + "version": "==2.0.1" }, "django-activeurl": { "hashes": [ @@ -92,25 +92,24 @@ }, "django-agent-trust": { "hashes": [ - "sha256:962653c4eeab63715a6efd27649a00302082c9fb1d931e3df959e57605eb8c25", - "sha256:b262db89410b9901c32f27f7dd6697bf61bfcfdc01651fe40699d0b81ebc4fcc" + "sha256:f0ded1c2e1e8b06ea050f48c8db931ab7d2f85c566065dceb8e827d0690d87c5", + "sha256:f7e24d3f50a0727c6a70d671778de3cca23a0c87bedc6e3dae1f61af7e759fc1" ], - "version": "==0.3.0" + "version": "==0.3.1" }, "django-analytical": { "hashes": [ - "sha256:9060a34a5d1882021a399a52c6af993f790deb7f9abf7dfbb84fe3033e0cb134", - "sha256:e7c8e026d0a10d41cffa06163fcee24870597cedba19d5fa2609d35dec6463fc" + "sha256:44dd65e30a3f11519852d5f5e50556c0f88cabb5720a2fd3637621952048abef", + "sha256:cf7b4c0b368139a090da2b0b45741bdd28b54daa0cb2b83ef801021c8eb2c050" ], - "version": "==2.3.0" + "version": "==2.4.0" }, "django-annoying": { "hashes": [ - "sha256:07267defd06e37ad287053de4ea8c83ab4aae8114628830b7c91b70b63494572", - "sha256:1884f1452e0b9542c7db2ed7d8cc728b9386bc20af7c8e03607fad31a28b7ead", - "sha256:5321e6e3481fc455818b935824d9cd78669a9bb6a964baf816d191745c8617a6" + "sha256:ee620f9bfe439061010c7d5ccc8c69514844d95c370c130c61938205fcfc4cc9", + "sha256:93f54d244d453cba28d6cfb9deae7bba27e859762adee9ff7de4706017940931" ], - "version": "==0.10.3" + "version": "==0.10.4" }, "django-appconf": { "hashes": [ @@ -128,9 +127,9 @@ }, "django-compat": { "hashes": [ - "sha256:b20fb26d15bbedbf26fb274eb400d6fad2a23655eb5741ae258d39557b5fc5a3" + "sha256:3ac9a3bedc56b9365d9eb241bc5157d0c193769bf995f9a78dc1bc24e7c2331b" ], - "version": "==1.0.14" + "version": "==1.0.15" }, "django-compressor": { "hashes": [ @@ -139,6 +138,13 @@ ], "version": "==2.2" }, + "django-cors-headers": { + "hashes": [ + "sha256:4e02be61ffaaab5917f1fd7cc3c305c4fb7ccd0156a649c96f49bc0a09c5f572", + "sha256:451bc37a514792c2b46c52362368f7985985933ecdbf1a85f82652579a5cbe01" + ], + "version": "==2.1.0" + }, "django-debug-toolbar": { "hashes": [ "sha256:4af2a4e1e932dadbda197b18585962d4fc20172b4e5a479490bc659fe998864d", @@ -161,16 +167,17 @@ }, "django-model-utils": { "hashes": [ - "sha256:60ead1ba50e1353f38bde12ab8b4a80b6a0f825a8e53c348fe259548cbd1a312" + "sha256:4356fad5f6fc9910da865fbf9371f9c2e028606dff2bbd8e32e67569260e530d", + "sha256:a9baa7de943b4e8afa61728ce8c42ce99e88cc87d40e74df2b060a78d22c0f5c" ], - "version": "==3.0.0" + "version": "==3.1.1" }, "django-otp": { "hashes": [ - "sha256:54f35d7a84d8c46f35d20b969f38ef1afc0fa7627e44c481e4ab5f66a8da187e", - "sha256:46fa6f2ae30a69a09bdc448b06a370c88d95fb0c3a9ba5771ca4d0d7740d56d7" + "sha256:06047e6f20e1527363ced31e4e8ea090f531cb33f4acd1bcaa6358a2efc05dbe", + "sha256:b1b0166717e35363e8b8fba7d23e5a3e4f175b4893b2e1b68ac8bd3e1908c6a9" ], - "version": "==0.4.1.1" + "version": "==0.4.2" }, "django-otp-agents": { "hashes": [ @@ -194,10 +201,10 @@ }, "django-rq": { "hashes": [ - "sha256:7cd517c3e243603c8e5b24bfc4797d57d751a4ba1b471124157e9822a83335a2", - "sha256:368051f0a3ef08670dd186ea0202cbc7644e199fd48fd31eace2e637e915a7f7" + "sha256:88d590adc528256a90db2456164288d7fd1e3aa337b96766fb5e94d2a448a1c4", + "sha256:628216d036004418d3adea589f7e971134d554995f7692ebb28501dabb7fb31e" ], - "version": "==0.9.6" + "version": "==1.0.1" }, "django-shorturls": { "hashes": [ @@ -233,10 +240,10 @@ }, "html5lib": { "hashes": [ - "sha256:08a3efc117a4fc8c82c3c6d10d6f58ae266428d57ed50258a1466d2cd88de745", - "sha256:0d5fd54d5b2b79b876007a70c033a4023577768d18022c15681c00561432a0f9" + "sha256:20b159aa3badc9d5ee8f5c647e5efd02ed2a66ab8d354930bd9ff139fc1dc0a3", + "sha256:66cb0dcfdbbc4f9c3ba1a63fdb511ffdbd4f513b2b6d81b80cd26ce6b3fb3736" ], - "version": "==1.0b10" + "version": "==1.0.1" }, "idna": { "hashes": [ @@ -287,9 +294,10 @@ }, "markdown": { "hashes": [ - "sha256:73af797238b95768b3a9b6fe6270e250e5c09d988b8e5b223fd5efa4e06faf81" + "sha256:9ba587db9daee7ec761cfc656272be6aabe2ed300fece21208e4aab2e457bc8f", + "sha256:a856869c7ff079ad84a3e19cd87a64998350c2b94e9e08e44270faef33400f81" ], - "version": "==2.6.9" + "version": "==2.6.11" }, "mf2py": { "hashes": [ @@ -305,77 +313,55 @@ }, "msgpack-python": { "hashes": [ - "sha256:637b012c9ea021de7a7a75d6ff5e82cfef6694babd7e14bb9a3adcb2a5bd52f0", - "sha256:658c1cd5dcf7786e0e7a6d523cd0c5b33f92e139e224bd73cb3a23ada618d2dc", - "sha256:920bbbaee07ad048a4d2b4160901b19775c61ef9439f856c74509e763a326249", - "sha256:e165006f7e3d2612f1bffe2f6f042ca317d8df724d8b72a39b14c2e46c67eaae", - "sha256:95d70edd50e3d2f6ea1189f77190e4a0172626e7405ddd1689f3f64814447cba", - "sha256:7e1b12ea0134460052fabcfaa0f488ec0fc21deb14832d66236fd2870757d8f1", - "sha256:8f36890251f20d96267618cf64735759d7ef7e91bc0b86b9480547d2d1397a68", - "sha256:1e68a277e4180baa7789be36f27f0891660205f6209f78a32282d3c422873d78", - "sha256:f52d9f96df952369fe4adcb0506e10c1c92d47f653f601a66da2a26a7e7141ea", - "sha256:58c9c1d7891a35bddc6ee5dbec10d347a7ae4983169c24fc5fc8a57ae792ca76", - "sha256:1a2b19df0f03519ec7f19f826afb935b202d8979b0856c6fb3dc28955799f886" + "sha256:69aa1eb0e13be1d3bd495ca937eae66df4431126f5cfd5491dc40370e5644853" ], - "version": "==0.4.8" - }, - "olefile": { - "hashes": [ - "sha256:61f2ca0cd0aa77279eb943c07f607438edf374096b66332fae1ee64a6f0f73ad" - ], - "version": "==0.44" + "version": "==0.5.1" }, "pillow": { "hashes": [ - "sha256:cc6a5ed5b8f9d2f25e4e42d562e0ec4df3ce838f9e9b9d9d9b65fac6fe93a4cc", - "sha256:54898190b538a6c8fa4228e866ff2e7609da1ba9fd1d9cc5dc8ca591d37ce0a8", - "sha256:a336596b06e062b92eb8201a3b5dff07ae01c3a5d08ce5539d2da49b123f2be6", - "sha256:922aeb050bd52d8ce9531ab57fd2440bfe975900e8700fec385fb741c3c557c7", - "sha256:6d814aa655d94c63547fc3208cb6ab886ff1a64c543b31f52658663b1bb3f011", - "sha256:e66080685863444738f08e13081c287e340b6e4f8bd674a2e0da967776ac6f46", - "sha256:575a9b3468c82f38be0419cd39d35001ae95a0cc5226534e45430035fecef583", - "sha256:4fb8ab0f8895fb946454ef6ffe806f49ee387095f2d6112ae24670e5fb8fbcd9", - "sha256:1d742642d01914b7e0cf6fd597a51f57d21fd68f794cf84803e03e72db78a261", - "sha256:59cef683d79b85d55a950c1e61dc7b6be0c45a5074692746354cd9a8ace1cd17", - "sha256:822e4fc261d12fa44d88dadee0e93d59663db94d962d4ffffbf09b1fe5e5be51", - "sha256:a6f43511c79bed431ec2b56e55150b5222c732cd9e5f80e77a44e068e94c71fc", - "sha256:2046a2001e2c413998951cc28aa0dbfd4cff846a12e24c2145d42630d5104094", - "sha256:39c7c9dcf64430091e30ef14d4191b4cae9b7b5ff29762357730aac4866fb189", - "sha256:f2d71951f473744ac617b645b62d0c4df5372ef4618c425646bfe5e2e8878e61", - "sha256:9adcfa2477b7e279ebeee75b49f535518201bbd7d26ca2ef1cf6751cb6e658e8", - "sha256:0e3b56364a2c772c961a8faad8a835d3f24d8848310de035c9e07cc006035cbc", - "sha256:92087cb92a968421f42235f7d8153f4766b6ba213a6efb36b8060f3c9d294569", - "sha256:53eaec751151b5713a15b1cd62b06d0fc16d72f56623c15448728c554c30770b", - "sha256:e595312f67962d6b4fde3b7dffaaaca4becefa522d677676bb57b0ec5f8f921a", - "sha256:dc32362d0cadf18c3aef7040455760106cafe7dd3c211dc27c507e746376bb56", - "sha256:759e5e3e99c4ac87b99e9288a75236c63173d1bb24c8d3f9d9d2c8332fceeb0a", - "sha256:b13106cb83a3b7d1a02fafb94bfafbc980465ba948b76ea1996245959c6783d2", - "sha256:9184b9788a9cf677e53626a4dc141136a22d349a5480479b98defd3cfb5015a4", - "sha256:be803fae6af36639524a0f6861a8cface67bbec66c3416c3eaf592f1d45b8b20", - "sha256:effa82e72f5064439a3d2c7ff615b999eb1c4d65bb1f1e6ee6e2ddb345b3e81e", - "sha256:9dc002a914cefa710dcb9fb204d34f6cd822662047a6038178f5fc9bfa7be961", - "sha256:7b3cf7a80608ed661b77793f64e1f2bd1e77136ad0b750aa2c81fac9c7e2c785", - "sha256:a9bad3405a642649e68568fe9832e8f6ae585354ab0b4ae250816ead11a553a2", - "sha256:4d3dbd93b131013a71b2e98530dd4945a03c7994d42381e44a921dd8bec300bc", - "sha256:9a1514bee2e32e0d4c0f55ba7a20f4387f883e37c7d2db64ca50449ffebe86cc", - "sha256:a9721fe1f6fdfe0c108ea81b1a05dc216f1ec5bb65ef1de1d85fd00494d019e0", - "sha256:e75d745306ec8aac0e6903358fdfc7fb6854febe551ed753ee7a1cad058b61bb", - "sha256:ccc9c1f5ba413fc5ee09bc78de7dd2ad8e189edb48f3bc38acedd04a7f43a0c1", - "sha256:150e24462fd106074a9a63417a55fbb0c633716cef9511f1bd7a773972de14f4", - "sha256:250d8470661fd657c2583672ab5139f40e7f2ef28ecdc90f87563af0b27f6fba", - "sha256:a97c715d44efd5b4aa8d739b8fad88b93ed79f1b33fc2822d5802043f3b1b527", - "sha256:dbefe5aa0882f00f12eceb3fb7df57105cd87fae767ca025db4685b7577c2390", - "sha256:62a7bbf0a1120ff07a99ddedd383779a8d80bd9d363f3964b2b43a26cef6ea50", - "sha256:42b4a67949085ddd4559c3c716a00a275fb45cb2c3a3aeec95c4b94419b7c243", - "sha256:0ac037e6c1746d63a1ea354f0d5974d8f3f984fc0333be373ad193711a89b1e9", - "sha256:8989cbf10ea07fc9982ec86116f6234bb3e44da481874ac94650d6176f60106f", - "sha256:77834551d3e928f3da922ce9dfb5c8db46758ea2f2922d4c5835a5b67a222aff", - "sha256:c00301e807084706bd46a1c56694ee235debe68eaf482c0186edfe07b93a9f6a", - "sha256:0163bd681d3488e2e9c26f4fbbfefcfb7f32259c431bfd2c3bc25574708a8b8c", - "sha256:223b06c337d8d60fb65af3b540ab1fa4644931d61d1fddf6e32f7a0e496685f2", - "sha256:1ab641cb7daf88e88ede8d3b89b7bd68a7099d8671160492d5e6845e24426080" + "sha256:718ec7a122b28d64afc5fbc3a9b99bb0545ef511373cac06fe7624520e82cb20", + "sha256:801cca8923508311bf5d6d0f7da5362552e8208ebd8ec0d7b9f2cd2ff5705734", + "sha256:43334f9581cd067945b8898cef9eb5714ee4883f8de0304c011f1dbdb1d4e2aa", + "sha256:153ec6f18f7b61641e0e6e502acfaf4a06c9aba2ea11c0b4b3578ea9f13a4a4a", + "sha256:25193f934d37d836a6b1f4c062ce574a96cbca7c6d9dc8ddfbbac7f9c54deaa4", + "sha256:b85f703c2ffe539313e39ce0676bed0f355cec45a16e58c9ab7417445843047c", + "sha256:8580fc58074a16b749905b26cf8363f7b628dd167ba0130f5382cdc91c86b509", + "sha256:2fcde9954c8882d1c7f93bb828caa34a4c5e3ee69dbc7895dc8652ad972b455a", + "sha256:1a5b93084e01328a1cb1ecdad99d11d75e881e89a95f88d85b523646553b36c2", + "sha256:b2240f298482f823576f397bb9f32ea913ad9456c526e141bc6f0a022b37a3e8", + "sha256:b1d33c63a55d0d85df0ad02b2c16158fb4d8153afa7b908f1a67330fac694cd6", + "sha256:6977cf073d83358b34f93abf5c1f1193b88675fe0e4441e0e28318bc3dcba7a0", + "sha256:1912b7230459fd53682dae32b83cbd8e5d642ba36d4be18566f00a9c063aa13d", + "sha256:4bd4a71501b6d51db4abc07e1f43f5a6fed0a1a9583cca0b401d6af50284b0db", + "sha256:0013f590a8f260df60bcfd65db19d18efc04e7f046c3c82a40e2e2b3292a937c", + "sha256:a224651a81e45ef4f1d0164e256c5f6b4abb49f2ae8f22ba2f3a9d0ff338e608", + "sha256:c793dfaa130847ccff958492b76ae8b9304e60b8a79a92962cb19e368276a22b", + "sha256:0b899ee80920bb533f26581af9b4660bc12aff4562555afe74e429101ebf3c94", + "sha256:9525cd680a6f9e80c6c0af03cf973e6505c59f60b4745f682cd1a449e54b31bb", + "sha256:35f7d998b8e82fb3fb51ff88b30485eb81cd7dd56ec7e1a8deba23eb88532d44", + "sha256:5b0d657460d9f3615876fec6306e97ca15a471f6169b622d76a47e270998acf1", + "sha256:ddd16ab250b4fc97db1c47407e78c25216a75c29d29d10ad37e51b7a2ec7b2c3", + "sha256:b9f63451084a718eccdeb1e382768c94647915653af4d6019f64560d9e98642b", + "sha256:a370d1c570f1d72e877099651e752332444b1c5009381f043c9da5fd47f3ebae", + "sha256:dc4b018d5c9b636f7546583c5591b9ea00c328c3e5871992ef5b95bac353f097", + "sha256:e126ff4fed71e78333840c07279e1617f63cfca76d63ad5b27d65a7277206a3d", + "sha256:fcf64c91fd44485100a2965d23bb0e227d093e91f7e776c5ca3b32574766eb56", + "sha256:2c042352b430d678db50c78c5214e19638eff8b688941271da2de21fd298dfe5", + "sha256:17fe25efc785194d48c38fad85dce470013ba19d2fb66639e149f14bccf1327f", + "sha256:2e818dbe445e86fc6c266973fe540c35125c42eb2cf13a6095e9adaa89c0deb5", + "sha256:135e9aa65150c53f7db85bf2bebb8a0e1a48ea850e80cf66e16dd04fa09d309c", + "sha256:7dfbefdb3fb911ca9faed307bf309861e9995e36cca6b761c7ba6d9b77a9744a", + "sha256:12f29d6c23424f704c66b5b68c02fe0b571504459605cfe36ab8158359b0e1bb", + "sha256:f8d49be8c282df8d2e1ab6ab53ab8abd859b1fa6fed384457ee85c9eff64ef97", + "sha256:82b172e3264e62372c01b5b009b5b1a02fbb9276cbe5cc57ab00a6d6e5ed9a18", + "sha256:57aa6198ba8acba1313c3b743e267d821a60cac77e6026caf0b55ca58d3d23be", + "sha256:d60c1625b108432ace8b1fa1a584017e5efa73f107d0f493c7f39c79bebf1d41", + "sha256:82d1ff571489765df2816785d532e243bde213752156c227fca595723ec5ff42", + "sha256:37cc0339abfa9e295c75d9a7f227d35cb44716feb95057f9449c4a9e9a17daf7", + "sha256:931030d1d6282b7900e6b0a7ff9ecdb503b5e1e6781800dab2b71a9f39405bff", + "sha256:5cd36804f9f06a914a883fe682df5711d16d7b4f44d43189c5f013e7cd91e149" ], - "version": "==4.3.0" + "version": "==5.0.0" }, "psycopg2": { "hashes": [ @@ -428,9 +414,10 @@ }, "python-memcached": { "hashes": [ - "sha256:2775829cb54b9e4c5b3bbd8028680f0c0ab695db154b9c46f0f074ff97540eb6" + "sha256:4dac64916871bd3550263323fc2ce18e1e439080a2d5670c594cf3118d99b594", + "sha256:a2e28637be13ee0bf1a8b6843e7490f9456fd3f2a4cb60471733c7b5d5557e4f" ], - "version": "==1.58" + "version": "==1.59" }, "python-slugify": { "hashes": [ @@ -514,10 +501,10 @@ }, "rq": { "hashes": [ - "sha256:aa9e73113713e3b2e8d633ebb5f8ceccf5c8c97c1aae4356dc3f46d446129f71", - "sha256:ae5b4507de1be3db4e737c3d59179c568b2906539f5eacaff218e5bb6b05937b" + "sha256:c1711bc43f298061166805763e6fa2353f03142e057e83f338d6e197a1be3157", + "sha256:31a5f04d1410111617ae78756b86fc6b0cf300fe7445843ea3758b86d9f67bc5" ], - "version": "==0.9.1" + "version": "==0.10.0" }, "six": { "hashes": [ @@ -535,10 +522,10 @@ }, "unidecode": { "hashes": [ - "sha256:61f807220eda0203a774a09f84b4304a3f93b5944110cc132af29ddb81366883", - "sha256:280a6ab88e1f2eb5af79edff450021a0d3f0448952847cd79677e55e58bad051" + "sha256:72f49d3729f3d8f5799f710b97c1451c5163102e76d64d20e170aedbbd923582", + "sha256:8c33dd588e0c9bc22a76eaa0c715a5434851f726131bd44a6c26471746efabf5" ], - "version": "==0.4.21" + "version": "==1.0.22" }, "urllib3": { "hashes": [ diff --git a/lemoncurry/settings/base.py b/lemoncurry/settings/base.py index 83aa8e4..68ced74 100644 --- a/lemoncurry/settings/base.py +++ b/lemoncurry/settings/base.py @@ -72,6 +72,7 @@ INSTALLED_APPS = [ 'analytical', 'annoying', 'compressor', + 'corsheaders', 'debug_toolbar', 'django_activeurl', 'django_agent_trust', @@ -95,6 +96,7 @@ MIDDLEWARE = [ 'debug_toolbar.middleware.DebugToolbarMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', + 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', @@ -218,6 +220,9 @@ SITE_ID = 1 # https://pythonhosted.org/django-agent-trust/ AGENT_COOKIE_SECURE = True +# django-cors-headers +CORS_ORIGIN_ALLOW_ALL = True + # django-shorturls # https://pypi.python.org/pypi/django-shorturls SHORTEN_MODELS = {