ソースを参照

added REST framework and basic setup

Apostol Mihai 2 年 前
コミット
c99de73127
5 ファイル変更54 行追加4 行削除
  1. 11 2
      NFTmarket/NFTmarket/settings.py
  2. 9 2
      NFTmarket/NFTmarket/urls.py
  3. 33 0
      package-lock.json
  4. 1 0
      package.json
  5. BIN
      requirements.txt

+ 11 - 2
NFTmarket/NFTmarket/settings.py

@@ -38,8 +38,8 @@ INSTALLED_APPS = [
     'django.contrib.sessions',
     'django.contrib.messages',
     'django.contrib.staticfiles',
-
-    'info_pages',
+    'rest_framework',
+    #'info_pages',
 ]
 
 MIDDLEWARE = [
@@ -70,6 +70,15 @@ TEMPLATES = [
     },
 ]
 
+REST_FRAMEWORK = {
+    # Use Django's standard `django.contrib.auth` permissions,
+    # or allow read-only access for unauthenticated users.
+    'DEFAULT_PERMISSION_CLASSES': [
+        'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
+    ]
+}
+
+
 WSGI_APPLICATION = 'NFTmarket.wsgi.application'
 
 

+ 9 - 2
NFTmarket/NFTmarket/urls.py

@@ -15,10 +15,17 @@ Including another URLconf
 """
 from django.contrib import admin
 from django.urls import include, path
-from info_pages.urls import infopages_urlpatterns
+#from info_pages.urls import infopages_urlpatterns
 
+from rest_framework import routers
+
+
+router = routers.DefaultRouter()
 
 urlpatterns = [
+
     path('admin/', admin.site.urls),
-    path(r'', include(infopages_urlpatterns)),
+    path('', include(router.urls)),
+    #path(r'', include(infopages_urlpatterns)),
+    path('api-auth/', include('rest_framework.urls'))
 ]

+ 33 - 0
package-lock.json

@@ -11,6 +11,7 @@
       "dependencies": {
         "react": "^18.1.0",
         "react-dom": "^18.1.0",
+        "scss": "^0.2.4",
         "styled-components": "^5.3.0"
       },
       "devDependencies": {
@@ -3035,6 +3036,14 @@
         "url": "https://github.com/sponsors/ljharb"
       }
     },
+    "node_modules/ometa": {
+      "version": "0.2.2",
+      "resolved": "https://registry.npmjs.org/ometa/-/ometa-0.2.2.tgz",
+      "integrity": "sha1-9TxHNbptVq9aRrBN+3xDNMWW1E4=",
+      "engines": {
+        "node": ">= 0.2.0"
+      }
+    },
     "node_modules/onetime": {
       "version": "5.1.2",
       "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
@@ -3364,6 +3373,17 @@
         "url": "https://opencollective.com/webpack"
       }
     },
+    "node_modules/scss": {
+      "version": "0.2.4",
+      "resolved": "https://registry.npmjs.org/scss/-/scss-0.2.4.tgz",
+      "integrity": "sha1-BA2QPtN8XU+krTOuH9OJrBKk4GU=",
+      "dependencies": {
+        "ometa": "0.2.2"
+      },
+      "engines": {
+        "node": ">= 0.2.0"
+      }
+    },
     "node_modules/semver": {
       "version": "6.3.0",
       "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
@@ -6047,6 +6067,11 @@
         "object-keys": "^1.1.1"
       }
     },
+    "ometa": {
+      "version": "0.2.2",
+      "resolved": "https://registry.npmjs.org/ometa/-/ometa-0.2.2.tgz",
+      "integrity": "sha1-9TxHNbptVq9aRrBN+3xDNMWW1E4="
+    },
     "onetime": {
       "version": "5.1.2",
       "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
@@ -6288,6 +6313,14 @@
         "ajv-keywords": "^3.5.2"
       }
     },
+    "scss": {
+      "version": "0.2.4",
+      "resolved": "https://registry.npmjs.org/scss/-/scss-0.2.4.tgz",
+      "integrity": "sha1-BA2QPtN8XU+krTOuH9OJrBKk4GU=",
+      "requires": {
+        "ometa": "0.2.2"
+      }
+    },
     "semver": {
       "version": "6.3.0",
       "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",

+ 1 - 0
package.json

@@ -25,6 +25,7 @@
   "dependencies": {
     "react": "^18.1.0",
     "react-dom": "^18.1.0",
+    "scss": "^0.2.4",
     "styled-components": "^5.3.0"
   }
 }

BIN
requirements.txt