├── .gitignore ├── README.md ├── backend ├── .dockerignore ├── .gitignore ├── Dockerfile ├── Pipfile ├── Pipfile.lock ├── sample │ ├── apps │ │ ├── __init__.py │ │ └── account │ │ │ ├── __init__.py │ │ │ ├── admin.py │ │ │ ├── apps.py │ │ │ ├── migrations │ │ │ ├── 0001_initial.py │ │ │ └── __init__.py │ │ │ ├── models.py │ │ │ ├── serializers.py │ │ │ ├── tests.py │ │ │ └── views.py │ ├── manage.py │ └── sample │ │ ├── __init__.py │ │ ├── settings.py │ │ ├── urls.py │ │ └── wsgi.py └── wait-for-it.sh ├── config ├── mysql │ └── my.cnf └── nginx │ └── app.conf ├── docker-compose.yml ├── frontend ├── .editorconfig ├── .eslintrc.js ├── .gitignore ├── Dockerfile ├── README.md ├── assets │ ├── README.md │ └── style │ │ └── app.styl ├── components │ ├── AppLogo.vue │ └── README.md ├── layouts │ ├── README.md │ └── default.vue ├── middleware │ └── README.md ├── nuxt.config.js ├── package.json ├── pages │ ├── README.md │ ├── admin.vue │ ├── general.vue │ └── index.vue ├── plugins │ ├── README.md │ ├── axios.js │ └── vuetify.js ├── static │ ├── README.md │ └── favicon.ico ├── store │ ├── README.md │ └── index.js └── yarn.lock └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules 3 | 4 | # logs 5 | npm-debug.log 6 | 7 | # Nuxt build 8 | .nuxt 9 | 10 | # Nuxt generate 11 | dist 12 | 13 | # Service Worker 14 | sw.js 15 | 16 | # settings 17 | .DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Nuxt Auth with Django Rest Framework 2 | Sample application for @nuxtjs/auth with Django Rest Framework(DRF).
3 | Do not use for production environments. 4 | 5 | # Overview 6 | ``` 7 | db -> port: 3306 8 | nuxt -> port:3000 9 | django -> port: 8000 10 | nginx -> port:80 11 | /admin,api,static -> proxy to django 12 | / -> proxy to nuxt 13 | ``` 14 | 15 | # API endpoint 16 | - login(create token): /api/auth/token/create/ (with username, password) 17 | - logout: /api/auth/token/destroy/ 18 | - get user property: /api/auth/me/ 19 | 20 | *generated by [djoser](https://github.com/sunscrapers/djoser) 21 | 22 | # How to use 23 | ``` 24 | git clone git@github.com:charly24/nuxt-django.git 25 | cd nuxt-django/ 26 | docker-compose up -d 27 | 28 | docker-compose run django pipenv run ./sample/manage.py migrate 29 | 30 | docker-compose run django pipenv run ./sample/manage.py createsuperuser 31 | ``` 32 | -------------------------------------------------------------------------------- /backend/.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .gitignore 3 | -------------------------------------------------------------------------------- /backend/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | .env 3 | __pycache__ 4 | .pytest_cache 5 | *.log 6 | *.db 7 | *.vscode 8 | -------------------------------------------------------------------------------- /backend/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.6 2 | ENV PYTHONUNBUFFERED 1 3 | RUN apt-get update && apt-get install -y mysql-client 4 | ADD . /app 5 | WORKDIR /app 6 | RUN pip install pipenv 7 | RUN pipenv install --dev 8 | CMD ["pipenv", "run" ,"./teamfinder/manage.py", "migrate"] -------------------------------------------------------------------------------- /backend/Pipfile: -------------------------------------------------------------------------------- 1 | [[source]] 2 | url = "https://pypi.python.org/simple" 3 | verify_ssl = true 4 | name = "pypi" 5 | 6 | [dev-packages] 7 | ipython = "*" 8 | mixer = "*" 9 | pytest-django = "*" 10 | django-extensions = "*" 11 | 12 | [packages] 13 | django = "==2.0.5" 14 | django-configurations = "*" 15 | django-extensions = "*" 16 | dj-database-url = "*" 17 | mysqlclient = "*" 18 | djangorestframework = "*" 19 | djoser = "*" 20 | django-cors-headers = "*" 21 | 22 | [requires] 23 | python_version = "3.6" 24 | -------------------------------------------------------------------------------- /backend/Pipfile.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_meta": { 3 | "hash": { 4 | "sha256": "a7ace8a7eaa3b7174c738982f6d58bcd33d8be134b466c7064f3e148086a9ae4" 5 | }, 6 | "pipfile-spec": 6, 7 | "requires": { 8 | "python_version": "3.6" 9 | }, 10 | "sources": [ 11 | { 12 | "name": "pypi", 13 | "url": "https://pypi.python.org/simple", 14 | "verify_ssl": true 15 | } 16 | ] 17 | }, 18 | "default": { 19 | "dj-database-url": { 20 | "hashes": [ 21 | "sha256:4aeaeb1f573c74835b0686a2b46b85990571159ffc21aa57ecd4d1e1cb334163", 22 | "sha256:851785365761ebe4994a921b433062309eb882fedd318e1b0fcecc607ed02da9" 23 | ], 24 | "index": "pypi", 25 | "version": "==0.5.0" 26 | }, 27 | "django": { 28 | "hashes": [ 29 | "sha256:26b34f4417aa38d895b6b5307177b51bc3f4d53179d8696a5c19dcb50582523c", 30 | "sha256:71d1a584bb4ad2b4f933d07d02c716755c1394feaac1ce61ce37843ac5401092" 31 | ], 32 | "index": "pypi", 33 | "version": "==2.0.5" 34 | }, 35 | "django-configurations": { 36 | "hashes": [ 37 | "sha256:b4a4eb3ed631c2abbeb7008b5cc5d8d04b190df838e7b613731d728f674f3a2f", 38 | "sha256:be47e25d070fd005cc8fbd6c913c9ec37e83d04686937afe18ca6c579b2cdedb" 39 | ], 40 | "index": "pypi", 41 | "version": "==2.0" 42 | }, 43 | "django-cors-headers": { 44 | "hashes": [ 45 | "sha256:0e9532628b3aa8806442d4d0b15e56112e6cfbef3735e13401935c98b842a2b4", 46 | "sha256:c7ec4816ec49416517b84f317499d1519db62125471922ab78d670474ed9b987" 47 | ], 48 | "index": "pypi", 49 | "version": "==2.2.0" 50 | }, 51 | "django-extensions": { 52 | "hashes": [ 53 | "sha256:3be3debf53c77ca795bdf713726c923aa3c3f895e1a42e2e31a68c1a562346a4", 54 | "sha256:94bfac99eb262c5ac27e53eda96925e2e53fe0b331af7dde37012d07639a649c" 55 | ], 56 | "index": "pypi", 57 | "version": "==2.0.7" 58 | }, 59 | "django-templated-mail": { 60 | "hashes": [ 61 | "sha256:8db807effebb42a532622e2d142dfd453dafcd0d7794c4c3332acb90656315f9", 62 | "sha256:f7127e1e31d7cad4e6c4b4801d25814d4b8782627ead76f4a75b3b7650687556" 63 | ], 64 | "version": "==1.1.1" 65 | }, 66 | "djangorestframework": { 67 | "hashes": [ 68 | "sha256:b6714c3e4b0f8d524f193c91ecf5f5450092c2145439ac2769711f7eba89a9d9", 69 | "sha256:c375e4f95a3a64fccac412e36fb42ba36881e52313ec021ef410b40f67cddca4" 70 | ], 71 | "index": "pypi", 72 | "version": "==3.8.2" 73 | }, 74 | "djoser": { 75 | "hashes": [ 76 | "sha256:5348b153d887dfea86e0ecafce1c63588705e8e74d907ba5b1d54ab94bf85ab1", 77 | "sha256:9b5cfccfbe3a515e3c7a76dc0179d1b5dc9d153543def6409405bab2a660b06f" 78 | ], 79 | "index": "pypi", 80 | "version": "==1.1.5" 81 | }, 82 | "mysqlclient": { 83 | "hashes": [ 84 | "sha256:1e85e48b167e2af3bb08f273fdbd1ad6401cbe75057fa6513f97387dc7b282dc", 85 | "sha256:2d9ec33de39f4d9c64ad7322ede0521d85829ce36a76f9dd3d6ab76a9c8648e5", 86 | "sha256:371df79d000af56b4e540b7ce2120d1c9afb04b751bfce25a1eb609c50fd10ff", 87 | "sha256:b3b1a7e4468180afb79289b54069d9499242946a4cedf3928cbf6b2a13800016", 88 | "sha256:d56e379c03efad746e84705cbb97401f60d1f98b05e11a27f2d9c2d043936974" 89 | ], 90 | "index": "pypi", 91 | "version": "==1.3.12" 92 | }, 93 | "pytz": { 94 | "hashes": [ 95 | "sha256:65ae0c8101309c45772196b21b74c46b2e5d11b6275c45d251b150d5da334555", 96 | "sha256:c06425302f2cf668f1bba7a0a03f3c1d34d4ebeef2c72003da308b3947c7f749" 97 | ], 98 | "version": "==2018.4" 99 | }, 100 | "six": { 101 | "hashes": [ 102 | "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9", 103 | "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb" 104 | ], 105 | "version": "==1.11.0" 106 | } 107 | }, 108 | "develop": { 109 | "appnope": { 110 | "hashes": [ 111 | "sha256:5b26757dc6f79a3b7dc9fab95359328d5747fcb2409d331ea66d0272b90ab2a0", 112 | "sha256:8b995ffe925347a2138d7ac0fe77155e4311a0ea6d6da4f5128fe4b3cbe5ed71" 113 | ], 114 | "markers": "sys_platform == 'darwin'", 115 | "version": "==0.1.0" 116 | }, 117 | "atomicwrites": { 118 | "hashes": [ 119 | "sha256:240831ea22da9ab882b551b31d4225591e5e447a68c5e188db5b89ca1d487585", 120 | "sha256:a24da68318b08ac9c9c45029f4a10371ab5b20e4226738e150e6e7c571630ae6" 121 | ], 122 | "version": "==1.1.5" 123 | }, 124 | "attrs": { 125 | "hashes": [ 126 | "sha256:4b90b09eeeb9b88c35bc642cbac057e45a5fd85367b985bd2809c62b7b939265", 127 | "sha256:e0d0eb91441a3b53dab4d9b743eafc1ac44476296a2053b6ca3af0b139faf87b" 128 | ], 129 | "version": "==18.1.0" 130 | }, 131 | "backcall": { 132 | "hashes": [ 133 | "sha256:38ecd85be2c1e78f77fd91700c76e14667dc21e2713b63876c0eb901196e01e4", 134 | "sha256:bbbf4b1e5cd2bdb08f915895b51081c041bac22394fdfcfdfbe9f14b77c08bf2" 135 | ], 136 | "version": "==0.1.0" 137 | }, 138 | "decorator": { 139 | "hashes": [ 140 | "sha256:2c51dff8ef3c447388fe5e4453d24a2bf128d3a4c32af3fabef1f01c6851ab82", 141 | "sha256:c39efa13fbdeb4506c476c9b3babf6a718da943dab7811c206005a4a956c080c" 142 | ], 143 | "version": "==4.3.0" 144 | }, 145 | "django-extensions": { 146 | "hashes": [ 147 | "sha256:3be3debf53c77ca795bdf713726c923aa3c3f895e1a42e2e31a68c1a562346a4", 148 | "sha256:94bfac99eb262c5ac27e53eda96925e2e53fe0b331af7dde37012d07639a649c" 149 | ], 150 | "index": "pypi", 151 | "version": "==2.0.7" 152 | }, 153 | "faker": { 154 | "hashes": [ 155 | "sha256:2f6ccc9da046d4cd20401734cf6a1ac73a4e4d8256e7b283496ee6827ad2eb60", 156 | "sha256:e928cf853ef69d7471421f2a3716a1239e43de0fa9855f4016ee0c9f1057328a" 157 | ], 158 | "version": "==0.8.8" 159 | }, 160 | "ipython": { 161 | "hashes": [ 162 | "sha256:a0c96853549b246991046f32d19db7140f5b1a644cc31f0dc1edc86713b7676f", 163 | "sha256:eca537aa61592aca2fef4adea12af8e42f5c335004dfa80c78caf80e8b525e5c" 164 | ], 165 | "index": "pypi", 166 | "version": "==6.4.0" 167 | }, 168 | "ipython-genutils": { 169 | "hashes": [ 170 | "sha256:72dd37233799e619666c9f639a9da83c34013a73e8bbc79a7a6348d93c61fab8", 171 | "sha256:eb2e116e75ecef9d4d228fdc66af54269afa26ab4463042e33785b887c628ba8" 172 | ], 173 | "version": "==0.2.0" 174 | }, 175 | "jedi": { 176 | "hashes": [ 177 | "sha256:1972f694c6bc66a2fac8718299e2ab73011d653a6d8059790c3476d2353b99ad", 178 | "sha256:5861f6dc0c16e024cbb0044999f9cf8013b292c05f287df06d3d991a87a4eb89" 179 | ], 180 | "version": "==0.12.0" 181 | }, 182 | "mixer": { 183 | "hashes": [ 184 | "sha256:159b6e3e1fa6aea1d5af101986f8bb6e283be56e0ed4fb9562f1b721de604938", 185 | "sha256:f7cc0fd3b7177e459178c7a7fc57d827a8e0470f3c60f34470bddcf5362aedf6" 186 | ], 187 | "index": "pypi", 188 | "version": "==6.0.1" 189 | }, 190 | "more-itertools": { 191 | "hashes": [ 192 | "sha256:2b6b9893337bfd9166bee6a62c2b0c9fe7735dcf85948b387ec8cba30e85d8e8", 193 | "sha256:6703844a52d3588f951883005efcf555e49566a48afd4db4e965d69b883980d3", 194 | "sha256:a18d870ef2ffca2b8463c0070ad17b5978056f403fb64e3f15fe62a52db21cc0" 195 | ], 196 | "version": "==4.2.0" 197 | }, 198 | "parso": { 199 | "hashes": [ 200 | "sha256:cdef26e8adc10d589f3ec4eb444bd0a29f3f1eb6d72a4292ab8afcb9d68976a6", 201 | "sha256:f0604a40b96e062b0fd99cf134cc2d5cdf66939d0902f8267d938b0d5b26707f" 202 | ], 203 | "version": "==0.2.1" 204 | }, 205 | "pexpect": { 206 | "hashes": [ 207 | "sha256:2a8e88259839571d1251d278476f3eec5db26deb73a70be5ed5dc5435e418aba", 208 | "sha256:3fbd41d4caf27fa4a377bfd16fef87271099463e6fa73e92a52f92dfee5d425b" 209 | ], 210 | "markers": "sys_platform != 'win32'", 211 | "version": "==4.6.0" 212 | }, 213 | "pickleshare": { 214 | "hashes": [ 215 | "sha256:84a9257227dfdd6fe1b4be1319096c20eb85ff1e82c7932f36efccfe1b09737b", 216 | "sha256:c9a2541f25aeabc070f12f452e1f2a8eae2abd51e1cd19e8430402bdf4c1d8b5" 217 | ], 218 | "version": "==0.7.4" 219 | }, 220 | "pluggy": { 221 | "hashes": [ 222 | "sha256:7f8ae7f5bdf75671a718d2daf0a64b7885f74510bcd98b1a0bb420eb9a9d0cff", 223 | "sha256:d345c8fe681115900d6da8d048ba67c25df42973bda370783cd58826442dcd7c", 224 | "sha256:e160a7fcf25762bb60efc7e171d4497ff1d8d2d75a3d0df7a21b76821ecbf5c5" 225 | ], 226 | "version": "==0.6.0" 227 | }, 228 | "prompt-toolkit": { 229 | "hashes": [ 230 | "sha256:1df952620eccb399c53ebb359cc7d9a8d3a9538cb34c5a1344bdbeb29fbcc381", 231 | "sha256:3f473ae040ddaa52b52f97f6b4a493cfa9f5920c255a12dc56a7d34397a398a4", 232 | "sha256:858588f1983ca497f1cf4ffde01d978a3ea02b01c8a26a8bbc5cd2e66d816917" 233 | ], 234 | "version": "==1.0.15" 235 | }, 236 | "ptyprocess": { 237 | "hashes": [ 238 | "sha256:e64193f0047ad603b71f202332ab5527c5e52aa7c8b609704fc28c0dc20c4365", 239 | "sha256:e8c43b5eee76b2083a9badde89fd1bbce6c8942d1045146e100b7b5e014f4f1a" 240 | ], 241 | "version": "==0.5.2" 242 | }, 243 | "py": { 244 | "hashes": [ 245 | "sha256:29c9fab495d7528e80ba1e343b958684f4ace687327e6f789a94bf3d1915f881", 246 | "sha256:983f77f3331356039fdd792e9220b7b8ee1aa6bd2b25f567a963ff1de5a64f6a" 247 | ], 248 | "version": "==1.5.3" 249 | }, 250 | "pygments": { 251 | "hashes": [ 252 | "sha256:78f3f434bcc5d6ee09020f92ba487f95ba50f1e3ef83ae96b9d5ffa1bab25c5d", 253 | "sha256:dbae1046def0efb574852fab9e90209b23f556367b5a320c0bcb871c77c3e8cc" 254 | ], 255 | "version": "==2.2.0" 256 | }, 257 | "pytest": { 258 | "hashes": [ 259 | "sha256:26838b2bc58620e01675485491504c3aa7ee0faf335c37fcd5f8731ca4319591", 260 | "sha256:32c49a69566aa7c333188149ad48b58ac11a426d5352ea3d8f6ce843f88199cb" 261 | ], 262 | "version": "==3.6.1" 263 | }, 264 | "pytest-django": { 265 | "hashes": [ 266 | "sha256:534505e0261cc566279032d9d887f844235342806fd63a6925689670fa1b29d7", 267 | "sha256:7501942093db2250a32a4e36826edfc542347bb9b26c78ed0649cdcfd49e5789" 268 | ], 269 | "index": "pypi", 270 | "version": "==3.2.1" 271 | }, 272 | "python-dateutil": { 273 | "hashes": [ 274 | "sha256:1adb80e7a782c12e52ef9a8182bebeb73f1d7e24e374397af06fb4956c8dc5c0", 275 | "sha256:e27001de32f627c22380a688bcc43ce83504a7bc5da472209b4c70f02829f0b8" 276 | ], 277 | "version": "==2.7.3" 278 | }, 279 | "simplegeneric": { 280 | "hashes": [ 281 | "sha256:dc972e06094b9af5b855b3df4a646395e43d1c9d0d39ed345b7393560d0b9173" 282 | ], 283 | "version": "==0.8.1" 284 | }, 285 | "six": { 286 | "hashes": [ 287 | "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9", 288 | "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb" 289 | ], 290 | "version": "==1.11.0" 291 | }, 292 | "text-unidecode": { 293 | "hashes": [ 294 | "sha256:5a1375bb2ba7968740508ae38d92e1f889a0832913cb1c447d5e2046061a396d", 295 | "sha256:801e38bd550b943563660a91de8d4b6fa5df60a542be9093f7abf819f86050cc" 296 | ], 297 | "version": "==1.2" 298 | }, 299 | "traitlets": { 300 | "hashes": [ 301 | "sha256:9c4bd2d267b7153df9152698efb1050a5d84982d3384a37b2c1f7723ba3e7835", 302 | "sha256:c6cb5e6f57c5a9bdaa40fa71ce7b4af30298fbab9ece9815b5d995ab6217c7d9" 303 | ], 304 | "version": "==4.3.2" 305 | }, 306 | "wcwidth": { 307 | "hashes": [ 308 | "sha256:3df37372226d6e63e1b1e1eda15c594bca98a22d33a23832a90998faa96bc65e", 309 | "sha256:f4ebe71925af7b40a864553f761ed559b43544f8f71746c2d756c7fe788ade7c" 310 | ], 311 | "version": "==0.1.7" 312 | } 313 | } 314 | } 315 | -------------------------------------------------------------------------------- /backend/sample/apps/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charly24/nuxt-django/a7e243cb35ed40e28761325bb979708ee132afaf/backend/sample/apps/__init__.py -------------------------------------------------------------------------------- /backend/sample/apps/account/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charly24/nuxt-django/a7e243cb35ed40e28761325bb979708ee132afaf/backend/sample/apps/account/__init__.py -------------------------------------------------------------------------------- /backend/sample/apps/account/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from django.contrib.auth.admin import UserAdmin 3 | 4 | from apps.account.models import User 5 | 6 | 7 | admin.site.register(User, UserAdmin) 8 | -------------------------------------------------------------------------------- /backend/sample/apps/account/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AccountConfig(AppConfig): 5 | name = 'account' 6 | -------------------------------------------------------------------------------- /backend/sample/apps/account/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.0.5 on 2018-06-06 02:11 2 | 3 | import django.contrib.auth.models 4 | import django.contrib.auth.validators 5 | from django.db import migrations, models 6 | import django.utils.timezone 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | initial = True 12 | 13 | dependencies = [ 14 | ('auth', '0009_alter_user_last_name_max_length'), 15 | ] 16 | 17 | operations = [ 18 | migrations.CreateModel( 19 | name='User', 20 | fields=[ 21 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 22 | ('password', models.CharField(max_length=128, verbose_name='password')), 23 | ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), 24 | ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), 25 | ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')), 26 | ('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')), 27 | ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')), 28 | ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')), 29 | ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), 30 | ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), 31 | ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), 32 | ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')), 33 | ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), 34 | ], 35 | options={ 36 | 'verbose_name': 'user', 37 | 'verbose_name_plural': 'users', 38 | 'abstract': False, 39 | }, 40 | managers=[ 41 | ('objects', django.contrib.auth.models.UserManager()), 42 | ], 43 | ), 44 | ] 45 | -------------------------------------------------------------------------------- /backend/sample/apps/account/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charly24/nuxt-django/a7e243cb35ed40e28761325bb979708ee132afaf/backend/sample/apps/account/migrations/__init__.py -------------------------------------------------------------------------------- /backend/sample/apps/account/models.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth.models import AbstractUser 2 | 3 | 4 | class User(AbstractUser): 5 | pass 6 | -------------------------------------------------------------------------------- /backend/sample/apps/account/serializers.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth import get_user_model 2 | from djoser.serializers import UserSerializer 3 | from rest_framework import serializers 4 | 5 | User = get_user_model() 6 | 7 | 8 | class CustomUserSerializer(UserSerializer): 9 | class Meta: 10 | model = User 11 | fields = tuple(User.REQUIRED_FIELDS) + ( 12 | User._meta.pk.name, 13 | User.USERNAME_FIELD, 14 | 'scope', 15 | ) 16 | read_only_fields = (User.USERNAME_FIELD,) 17 | 18 | scope = serializers.SerializerMethodField() 19 | 20 | def get_scope(self, user): 21 | if user.is_superuser: 22 | return ['admin'] 23 | else: 24 | return ['general'] 25 | -------------------------------------------------------------------------------- /backend/sample/apps/account/tests.py: -------------------------------------------------------------------------------- 1 | # Create your tests here. 2 | -------------------------------------------------------------------------------- /backend/sample/apps/account/views.py: -------------------------------------------------------------------------------- 1 | # Create your views here. 2 | -------------------------------------------------------------------------------- /backend/sample/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sample.settings") 7 | os.environ.setdefault("DJANGO_CONFIGURATION", "Development") 8 | try: 9 | from configurations.management import execute_from_command_line 10 | except ImportError as exc: 11 | raise ImportError( 12 | "Couldn't import Django. Are you sure it's installed and " 13 | "available on your PYTHONPATH environment variable? Did you " 14 | "forget to activate a virtual environment?" 15 | ) from exc 16 | execute_from_command_line(sys.argv) 17 | -------------------------------------------------------------------------------- /backend/sample/sample/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charly24/nuxt-django/a7e243cb35ed40e28761325bb979708ee132afaf/backend/sample/sample/__init__.py -------------------------------------------------------------------------------- /backend/sample/sample/settings.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from configurations import Configuration, values 4 | 5 | 6 | class Base(Configuration): 7 | IS_TEST = values.BooleanValue(False) 8 | DEBUG = values.BooleanValue(False) 9 | SECRET_KEY = values.SecretValue() 10 | 11 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 12 | 13 | DATABASES = values.DatabaseURLValue() 14 | 15 | ALLOWED_HOSTS = [] 16 | 17 | INSTALLED_APPS = [ 18 | 'django.contrib.admin', 19 | 'django.contrib.auth', 20 | 'django.contrib.contenttypes', 21 | 'django.contrib.sessions', 22 | 'django.contrib.messages', 23 | 'django.contrib.staticfiles', 24 | 'rest_framework', 25 | 'rest_framework.authtoken', 26 | 'corsheaders', 27 | 'djoser', 28 | 'apps.account', 29 | ] 30 | 31 | MIDDLEWARE = [ 32 | 'django.middleware.security.SecurityMiddleware', 33 | 'django.contrib.sessions.middleware.SessionMiddleware', 34 | 'corsheaders.middleware.CorsMiddleware', 35 | 'django.middleware.common.CommonMiddleware', 36 | 'django.middleware.csrf.CsrfViewMiddleware', 37 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 38 | 'django.contrib.messages.middleware.MessageMiddleware', 39 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 40 | ] 41 | 42 | ROOT_URLCONF = 'sample.urls' 43 | 44 | TEMPLATES = [ 45 | { 46 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 47 | 'DIRS': [], 48 | 'APP_DIRS': True, 49 | 'OPTIONS': { 50 | 'context_processors': [ 51 | 'django.template.context_processors.debug', 52 | 'django.template.context_processors.request', 53 | 'django.contrib.auth.context_processors.auth', 54 | 'django.contrib.messages.context_processors.messages', 55 | ], 56 | }, 57 | }, 58 | ] 59 | 60 | # WSGI 61 | 62 | WSGI_APPLICATION = 'sample.wsgi.application' 63 | 64 | # Password validators 65 | 66 | AUTH_PASSWORD_VALIDATORS = [ 67 | { 68 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 69 | }, 70 | { 71 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 72 | }, 73 | { 74 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 75 | }, 76 | { 77 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 78 | }, 79 | ] 80 | 81 | AUTH_USER_MODEL = 'account.User' 82 | 83 | # Internationalization 84 | 85 | LANGUAGE_CODE = 'ja-JP' 86 | TIME_ZONE = 'Asia/Tokyo' 87 | USE_I18N = True 88 | USE_L10N = True 89 | USE_TZ = True 90 | 91 | # Static files 92 | STATIC_URL = '/static/' 93 | STATIC_BASE = os.path.join(BASE_DIR, 'static') 94 | STATICFILES_DIRS = ( 95 | STATIC_BASE, 96 | ) 97 | 98 | # REST 99 | REST_FRAMEWORK = { 100 | 'DEFAULT_AUTHENTICATION_CLASSES': ( 101 | 'rest_framework.authentication.TokenAuthentication', 102 | 'rest_framework.authentication.BasicAuthentication', 103 | 'rest_framework.authentication.SessionAuthentication', 104 | ), 105 | 'DEFAULT_PAGINATION_CLASS': 106 | 'rest_framework.pagination.PageNumberPagination', 107 | 'PAGE_SIZE': 100, 108 | } 109 | 110 | DJOSER = { 111 | 'SERIALIZERS': { 112 | 'user': 'apps.account.serializers.CustomUserSerializer', 113 | } 114 | } 115 | 116 | 117 | class Development(Base): 118 | DEBUG = values.BooleanValue(True) 119 | CORS_ORIGIN_ALLOW_ALL = True 120 | ALLOWED_HOSTS = ['localhost'] 121 | INSTALLED_APPS = Base.INSTALLED_APPS + ['django_extensions'] 122 | 123 | 124 | class Production(Base): 125 | pass 126 | 127 | 128 | class Testing(Base): 129 | pass 130 | -------------------------------------------------------------------------------- /backend/sample/sample/urls.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from django.urls import path, include 3 | 4 | urlpatterns = [ 5 | path('admin/', admin.site.urls), 6 | path('api/auth/', include('djoser.urls')), 7 | path('api/auth/', include('djoser.urls.authtoken')), 8 | ] 9 | -------------------------------------------------------------------------------- /backend/sample/sample/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for sample project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sample.settings") 15 | os.environ.setdefault('DJANGO_CONFIGURATION', 'Development') 16 | 17 | application = get_wsgi_application() 18 | -------------------------------------------------------------------------------- /backend/wait-for-it.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Use this script to test if a given TCP host/port are available 3 | 4 | cmdname=$(basename $0) 5 | 6 | echoerr() { if [[ $QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } 7 | 8 | usage() 9 | { 10 | cat << USAGE >&2 11 | Usage: 12 | $cmdname host:port [-s] [-t timeout] [-- command args] 13 | -h HOST | --host=HOST Host or IP under test 14 | -p PORT | --port=PORT TCP port under test 15 | Alternatively, you specify the host and port as host:port 16 | -s | --strict Only execute subcommand if the test succeeds 17 | -q | --quiet Don't output any status messages 18 | -t TIMEOUT | --timeout=TIMEOUT 19 | Timeout in seconds, zero for no timeout 20 | -- COMMAND ARGS Execute command with args after the test finishes 21 | USAGE 22 | exit 1 23 | } 24 | 25 | wait_for() 26 | { 27 | if [[ $TIMEOUT -gt 0 ]]; then 28 | echoerr "$cmdname: waiting $TIMEOUT seconds for $HOST:$PORT" 29 | else 30 | echoerr "$cmdname: waiting for $HOST:$PORT without a timeout" 31 | fi 32 | start_ts=$(date +%s) 33 | while : 34 | do 35 | if [[ $ISBUSY -eq 1 ]]; then 36 | nc -z $HOST $PORT 37 | result=$? 38 | else 39 | (echo > /dev/tcp/$HOST/$PORT) >/dev/null 2>&1 40 | result=$? 41 | fi 42 | if [[ $result -eq 0 ]]; then 43 | end_ts=$(date +%s) 44 | echoerr "$cmdname: $HOST:$PORT is available after $((end_ts - start_ts)) seconds" 45 | break 46 | fi 47 | sleep 1 48 | done 49 | return $result 50 | } 51 | 52 | wait_for_wrapper() 53 | { 54 | # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692 55 | if [[ $QUIET -eq 1 ]]; then 56 | timeout $BUSYTIMEFLAG $TIMEOUT $0 --quiet --child --host=$HOST --port=$PORT --timeout=$TIMEOUT & 57 | else 58 | timeout $BUSYTIMEFLAG $TIMEOUT $0 --child --host=$HOST --port=$PORT --timeout=$TIMEOUT & 59 | fi 60 | PID=$! 61 | trap "kill -INT -$PID" INT 62 | wait $PID 63 | RESULT=$? 64 | if [[ $RESULT -ne 0 ]]; then 65 | echoerr "$cmdname: timeout occurred after waiting $TIMEOUT seconds for $HOST:$PORT" 66 | fi 67 | return $RESULT 68 | } 69 | 70 | # process arguments 71 | while [[ $# -gt 0 ]] 72 | do 73 | case "$1" in 74 | *:* ) 75 | hostport=(${1//:/ }) 76 | HOST=${hostport[0]} 77 | PORT=${hostport[1]} 78 | shift 1 79 | ;; 80 | --child) 81 | CHILD=1 82 | shift 1 83 | ;; 84 | -q | --quiet) 85 | QUIET=1 86 | shift 1 87 | ;; 88 | -s | --strict) 89 | STRICT=1 90 | shift 1 91 | ;; 92 | -h) 93 | HOST="$2" 94 | if [[ $HOST == "" ]]; then break; fi 95 | shift 2 96 | ;; 97 | --host=*) 98 | HOST="${1#*=}" 99 | shift 1 100 | ;; 101 | -p) 102 | PORT="$2" 103 | if [[ $PORT == "" ]]; then break; fi 104 | shift 2 105 | ;; 106 | --port=*) 107 | PORT="${1#*=}" 108 | shift 1 109 | ;; 110 | -t) 111 | TIMEOUT="$2" 112 | if [[ $TIMEOUT == "" ]]; then break; fi 113 | shift 2 114 | ;; 115 | --timeout=*) 116 | TIMEOUT="${1#*=}" 117 | shift 1 118 | ;; 119 | --) 120 | shift 121 | CLI="$@" 122 | break 123 | ;; 124 | --help) 125 | usage 126 | ;; 127 | *) 128 | echoerr "Unknown argument: $1" 129 | usage 130 | ;; 131 | esac 132 | done 133 | 134 | if [[ "$HOST" == "" || "$PORT" == "" ]]; then 135 | echoerr "Error: you need to provide a host and port to test." 136 | usage 137 | fi 138 | 139 | TIMEOUT=${TIMEOUT:-15} 140 | STRICT=${STRICT:-0} 141 | CHILD=${CHILD:-0} 142 | QUIET=${QUIET:-0} 143 | 144 | # check to see if timeout is from busybox? 145 | # check to see if timeout is from busybox? 146 | TIMEOUT_PATH=$(realpath $(which timeout)) 147 | if [[ $TIMEOUT_PATH =~ "busybox" ]]; then 148 | ISBUSY=1 149 | BUSYTIMEFLAG="-t" 150 | else 151 | ISBUSY=0 152 | BUSYTIMEFLAG="" 153 | fi 154 | 155 | if [[ $CHILD -gt 0 ]]; then 156 | wait_for 157 | RESULT=$? 158 | exit $RESULT 159 | else 160 | if [[ $TIMEOUT -gt 0 ]]; then 161 | wait_for_wrapper 162 | RESULT=$? 163 | else 164 | wait_for 165 | RESULT=$? 166 | fi 167 | fi 168 | 169 | if [[ $CLI != "" ]]; then 170 | if [[ $RESULT -ne 0 && $STRICT -eq 1 ]]; then 171 | echoerr "$cmdname: strict mode, refusing to execute subprocess" 172 | exit $RESULT 173 | fi 174 | exec $CLI 175 | else 176 | exit $RESULT 177 | fi 178 | -------------------------------------------------------------------------------- /config/mysql/my.cnf: -------------------------------------------------------------------------------- 1 | [mysqld] 2 | character-set-server = utf8 3 | collation-server = utf8_unicode_ci 4 | skip-character-set-client-handshake -------------------------------------------------------------------------------- /config/nginx/app.conf: -------------------------------------------------------------------------------- 1 | upstream django { 2 | ip_hash; 3 | server django:8000; 4 | } 5 | 6 | upstream nuxt { 7 | ip_hash; 8 | server nuxt:3000; 9 | } 10 | 11 | server { 12 | location ~ /(api|admin|static)/ { 13 | proxy_pass http://django; 14 | proxy_set_header Host $http_host; 15 | proxy_set_header X-Forwarded-Host $host; 16 | } 17 | location / { 18 | proxy_pass http://nuxt; 19 | proxy_set_header Host $http_host; 20 | proxy_set_header X-Forwarded-Host $host; 21 | } 22 | listen 80; 23 | server_name localhost; 24 | } 25 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | db: 5 | image: mysql:5.7 6 | restart: always 7 | environment: 8 | MYSQL_DATABASE: sample 9 | MYSQL_ROOT_PASSWORD: password 10 | ports: 11 | - "3306:3306" 12 | volumes: 13 | - mysql-db:/var/lib/mysql 14 | - ./config/nginx/my.cnf:/etc/mysql/conf.d/my.cnf 15 | command: mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci 16 | django: 17 | build: 18 | context: ./backend 19 | command: ./wait-for-it.sh db:3306 -- pipenv run ./sample/manage.py runserver 0.0.0.0:8000 20 | environment: 21 | - DJANGO_SECRET_KEY=secret_key 22 | - DATABASE_URL=mysql://root:password@db:3306/sample 23 | expose: 24 | - "8000" 25 | ports: 26 | - "8000:8000" 27 | volumes: 28 | - ./backend:/app 29 | depends_on: 30 | - db 31 | nuxt: 32 | build: 33 | context: ./frontend 34 | command: bash -c "yarn run dev" 35 | volumes: 36 | - ./frontend:/app 37 | expose: 38 | - "3000" 39 | ports: 40 | - "3000:3000" 41 | depends_on: 42 | - django 43 | nginx: 44 | image: nginx:latest 45 | ports: 46 | - "80:80" 47 | volumes: 48 | - ./config/nginx:/etc/nginx/conf.d 49 | depends_on: 50 | - django 51 | - nuxt 52 | 53 | volumes: 54 | mysql-db: 55 | driver: local 56 | -------------------------------------------------------------------------------- /frontend/.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_size = 2 6 | indent_style = space 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /frontend/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parser: 'babel-eslint', 4 | env: { 5 | browser: true, 6 | node: true 7 | }, 8 | extends: 'standard', 9 | // required to lint *.vue files 10 | plugins: [ 11 | 'html' 12 | ], 13 | // add your custom rules here 14 | rules: {}, 15 | globals: {} 16 | } 17 | -------------------------------------------------------------------------------- /frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules 3 | 4 | # logs 5 | npm-debug.log 6 | 7 | # Nuxt build 8 | .nuxt 9 | 10 | # Nuxt generate 11 | dist 12 | -------------------------------------------------------------------------------- /frontend/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:latest 2 | ENV HOST 0.0.0.0 3 | ADD . /app 4 | WORKDIR /app 5 | EXPOSE 3000 6 | 7 | RUN npm install yarn 8 | RUN yarn -------------------------------------------------------------------------------- /frontend/README.md: -------------------------------------------------------------------------------- 1 | # sample 2 | 3 | > Nuxt Django Sample 4 | 5 | ## Build Setup 6 | 7 | ``` bash 8 | # install dependencies 9 | $ npm install # Or yarn install 10 | 11 | # serve with hot reload at localhost:3000 12 | $ npm run dev 13 | 14 | # build for production and launch server 15 | $ npm run build 16 | $ npm start 17 | 18 | # generate static project 19 | $ npm run generate 20 | ``` 21 | 22 | For detailed explanation on how things work, checkout the [Nuxt.js docs](https://github.com/nuxt/nuxt.js). 23 | -------------------------------------------------------------------------------- /frontend/assets/README.md: -------------------------------------------------------------------------------- 1 | # ASSETS 2 | 3 | This directory contains your un-compiled assets such as LESS, SASS, or JavaScript. 4 | 5 | More information about the usage of this directory in the documentation: 6 | https://nuxtjs.org/guide/assets#webpacked 7 | 8 | **This directory is not required, you can delete it if you don't want to use it.** 9 | -------------------------------------------------------------------------------- /frontend/assets/style/app.styl: -------------------------------------------------------------------------------- 1 | // Import Vuetify styling 2 | @require '~vuetify/src/stylus/main.styl' 3 | 4 | .page 5 | @extend .fade-transition 6 | -------------------------------------------------------------------------------- /frontend/components/AppLogo.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 80 | -------------------------------------------------------------------------------- /frontend/components/README.md: -------------------------------------------------------------------------------- 1 | # COMPONENTS 2 | 3 | The components directory contains your Vue.js Components. 4 | Nuxt.js doesn't supercharge these components. 5 | 6 | **This directory is not required, you can delete it if you don't want to use it.** 7 | -------------------------------------------------------------------------------- /frontend/layouts/README.md: -------------------------------------------------------------------------------- 1 | # LAYOUTS 2 | 3 | This directory contains your Application Layouts. 4 | 5 | More information about the usage of this directory in the documentation: 6 | https://nuxtjs.org/guide/views#layouts 7 | 8 | **This directory is not required, you can delete it if you don't want to use it.** 9 | -------------------------------------------------------------------------------- /frontend/layouts/default.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 24 | -------------------------------------------------------------------------------- /frontend/middleware/README.md: -------------------------------------------------------------------------------- 1 | # MIDDLEWARE 2 | 3 | This directory contains your Application Middleware. 4 | The middleware lets you define custom function to be ran before rendering a page or a group of pages (layouts). 5 | 6 | More information about the usage of this directory in the documentation: 7 | https://nuxtjs.org/guide/routing#middleware 8 | 9 | **This directory is not required, you can delete it if you don't want to use it.** 10 | -------------------------------------------------------------------------------- /frontend/nuxt.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | /* 3 | ** Headers of the page 4 | */ 5 | head: { 6 | title: 'sample', 7 | meta: [ 8 | { charset: 'utf-8' }, 9 | { name: 'viewport', content: 'width=device-width, initial-scale=1' }, 10 | { hid: 'description', name: 'description', content: 'Nuxt Django Sample' } 11 | ], 12 | link: [ 13 | { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }, 14 | { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons' } 15 | ] 16 | }, 17 | plugins: [ 18 | '~/plugins/vuetify.js', 19 | '~/plugins/axios' 20 | ], 21 | css: [ 22 | '~/assets/style/app.styl' 23 | ], 24 | modules: [ 25 | '@nuxtjs/axios', 26 | '@nuxtjs/auth' 27 | ], 28 | axios: { 29 | baseURL: 'http://django:8000', 30 | browserBaseURL: 'http://localhost:8000' 31 | }, 32 | toast: { 33 | position: 'center', 34 | theme: 'bubble' 35 | }, 36 | auth: { 37 | fetchUserOnLogin: true, 38 | strategies: { 39 | local: { 40 | endpoints: { 41 | login: { url: '/api/auth/token/create/', method: 'post', propertyName: 'auth_token' }, 42 | logout: { url: '/api/auth/token/destroy/', method: 'post' }, 43 | user: { url: '/api/auth/me/', propertyName: false }, 44 | }, 45 | tokenType: 'Token', 46 | tokenName: 'Authorization' 47 | } 48 | }, 49 | redirect: { 50 | login: '/', 51 | home: '/' 52 | } 53 | }, 54 | /* 55 | ** Customize the progress bar color 56 | */ 57 | loading: { color: '#3B8070' }, 58 | /* 59 | ** Build configuration 60 | */ 61 | build: { 62 | extractCSS: true, 63 | /* 64 | ** Run ESLint on save 65 | */ 66 | extend (config, ctx) { 67 | if (ctx.isDev && ctx.isClient) { 68 | config.module.rules.push({ 69 | enforce: 'pre', 70 | test: /\.(js|vue)$/, 71 | loader: 'eslint-loader', 72 | exclude: /(node_modules)/ 73 | }) 74 | } 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /frontend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sample", 3 | "version": "1.0.0", 4 | "description": "Nuxt Django Sample", 5 | "author": "ryo.nagaoka@sample.com", 6 | "private": true, 7 | "scripts": { 8 | "dev": "nuxt", 9 | "build": "nuxt build", 10 | "start": "nuxt start", 11 | "generate": "nuxt generate", 12 | "lint": "eslint --ext .js,.vue --ignore-path .gitignore .", 13 | "precommit": "npm run lint" 14 | }, 15 | "dependencies": { 16 | "@nuxtjs/auth": "^4.4.0", 17 | "@nuxtjs/axios": "^5.0.1", 18 | "body-parser": "^1.18.2", 19 | "connect-redis": "^3.3.3", 20 | "cross-env": "^5.1.3", 21 | "express": "^4.16.2", 22 | "express-session": "^1.15.6", 23 | "moment": "^2.20.1", 24 | "node-sass": "^4.9.0", 25 | "nuxt": "^1.0.0", 26 | "vue": "^2.5.0", 27 | "vuetify": "^1.0.0" 28 | }, 29 | "devDependencies": { 30 | "@vue/test-utils": "^1.0.0-beta.11", 31 | "ava": "^0.25.0", 32 | "babel-eslint": "^8.2.1", 33 | "browser-env": "^3.2.5", 34 | "eslint": "^4.15.0", 35 | "eslint-config-standard": "^10.2.1", 36 | "eslint-friendly-formatter": "^3.0.0", 37 | "eslint-loader": "^1.9.0", 38 | "eslint-plugin-html": "^3.1.1", 39 | "eslint-plugin-import": "^2.7.0", 40 | "eslint-plugin-node": "^5.1.1", 41 | "eslint-plugin-promise": "^3.5.0", 42 | "eslint-plugin-standard": "^3.0.1", 43 | "eslint-plugin-vue": "^4.0.0", 44 | "require-extension-hooks": "^0.3.2", 45 | "require-extension-hooks-babel": "^0.1.1", 46 | "require-extension-hooks-vue": "^0.4.1", 47 | "sass-loader": "^7.0.1", 48 | "stylus": "^0.54.5", 49 | "stylus-loader": "^3.0.1" 50 | }, 51 | "ava": { 52 | "require": [ 53 | "babel-register", 54 | "./test/setup.js" 55 | ], 56 | "snapshotDir": "./test/snapshot" 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /frontend/pages/README.md: -------------------------------------------------------------------------------- 1 | # PAGES 2 | 3 | This directory contains your Application Views and Routes. 4 | The framework reads all the .vue files inside this directory and creates the router of your application. 5 | 6 | More information about the usage of this directory in the documentation: 7 | https://nuxtjs.org/guide/routing 8 | -------------------------------------------------------------------------------- /frontend/pages/admin.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | -------------------------------------------------------------------------------- /frontend/pages/general.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | -------------------------------------------------------------------------------- /frontend/pages/index.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 48 | -------------------------------------------------------------------------------- /frontend/plugins/README.md: -------------------------------------------------------------------------------- 1 | # PLUGINS 2 | 3 | This directory contains your Javascript plugins that you want to run before instantiating the root vue.js application. 4 | 5 | More information about the usage of this directory in the documentation: 6 | https://nuxtjs.org/guide/plugins 7 | 8 | **This directory is not required, you can delete it if you don't want to use it.** 9 | -------------------------------------------------------------------------------- /frontend/plugins/axios.js: -------------------------------------------------------------------------------- 1 | export default function ({ $axios }) { 2 | // Django CSRF configuration 3 | $axios.onRequest(config => { 4 | config.xsrfCookieName = 'csrftoken' 5 | config.xsrfHeaderName = 'X-CSRFToken' 6 | }) 7 | } 8 | -------------------------------------------------------------------------------- /frontend/plugins/vuetify.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuetify from 'vuetify' 3 | 4 | Vue.use(Vuetify) 5 | -------------------------------------------------------------------------------- /frontend/static/README.md: -------------------------------------------------------------------------------- 1 | # STATIC 2 | 3 | This directory contains your static files. 4 | Each file inside this directory is mapped to /. 5 | 6 | Example: /static/robots.txt is mapped as /robots.txt. 7 | 8 | More information about the usage of this directory in the documentation: 9 | https://nuxtjs.org/guide/assets#static 10 | 11 | **This directory is not required, you can delete it if you don't want to use it.** 12 | -------------------------------------------------------------------------------- /frontend/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charly24/nuxt-django/a7e243cb35ed40e28761325bb979708ee132afaf/frontend/static/favicon.ico -------------------------------------------------------------------------------- /frontend/store/README.md: -------------------------------------------------------------------------------- 1 | # STORE 2 | 3 | This directory contains your Vuex Store files. 4 | Vuex Store option is implemented in the Nuxt.js framework. 5 | Creating a index.js file in this directory activate the option in the framework automatically. 6 | 7 | More information about the usage of this directory in the documentation: 8 | https://nuxtjs.org/guide/vuex-store 9 | 10 | **This directory is not required, you can delete it if you don't want to use it.** 11 | -------------------------------------------------------------------------------- /frontend/store/index.js: -------------------------------------------------------------------------------- 1 | export default { 2 | state: () => ({ 3 | }) 4 | } 5 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sample", 3 | "version": "1.0.0", 4 | "description": "Nuxt Django Sample", 5 | "author": "Ryo Nagaoka ", 6 | "private": true, 7 | "scripts": { 8 | "setup": "yarn run clean && yarn run copyassets && yarn run copystatic", 9 | "clean": "mkdir -p public && rm -rf public/*", 10 | "copyassets": "cp -R backend/ public/assets", 11 | "copystatic": "cp -R frontend/static/* public", 12 | } 13 | } 14 | --------------------------------------------------------------------------------