ChangkeYang 7 years ago
parent
commit
30aea16948
4 changed files with 15 additions and 14 deletions
  1. 8 14
      .idea/workspace.xml
  2. 1 0
      requirements.txt
  3. 6 0
      todo/settings.py
  4. BIN
      todo/settings.pyc

+ 8 - 14
.idea/workspace.xml

@@ -2,14 +2,8 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="33a8caf6-56b3-4b8d-a4ba-9f9f2e8d8e9c" name="Default" comment="">
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/api/task/urls.py" />
-      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/db.sqlite3" afterPath="$PROJECT_DIR$/db.sqlite3" />
-      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
-      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/api/task/admin.py" afterPath="$PROJECT_DIR$/api/task/admin.py" />
-      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/api/task/models.py" afterPath="$PROJECT_DIR$/api/task/models.py" />
-      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/api/task/views.py" afterPath="$PROJECT_DIR$/api/task/views.py" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/requirements.txt" afterPath="$PROJECT_DIR$/requirements.txt" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/todo/settings.py" afterPath="$PROJECT_DIR$/todo/settings.py" />
-      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/todo/urls.py" afterPath="$PROJECT_DIR$/todo/urls.py" />
     </list>
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
     <option name="TRACKING_ENABLED" value="true" />
@@ -27,8 +21,8 @@
       <file leaf-file-name="settings.py" pinned="false" current-in-tab="true">
         <entry file="file://$PROJECT_DIR$/todo/settings.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="386">
-              <caret line="57" column="8" lean-forward="false" selection-start-line="55" selection-start-column="3" selection-end-line="57" selection-end-column="8" />
+            <state relative-caret-position="338">
+              <caret line="59" column="0" lean-forward="true" selection-start-line="59" selection-start-column="0" selection-end-line="59" selection-end-column="0" />
               <folding />
             </state>
           </provider>
@@ -169,8 +163,8 @@
     <sorting>DEFINITION_ORDER</sorting>
   </component>
   <component name="ProjectFrameBounds">
-    <option name="x" value="1" />
-    <option name="y" value="23" />
+    <option name="x" value="316" />
+    <option name="y" value="168" />
     <option name="width" value="1024" />
     <option name="height" value="741" />
   </component>
@@ -483,7 +477,7 @@
     <servers />
   </component>
   <component name="ToolWindowManager">
-    <frame x="1" y="23" width="1024" height="741" extended-state="6" />
+    <frame x="316" y="168" width="1024" height="741" extended-state="0" />
     <editor active="true" />
     <layout>
       <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25097656" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
@@ -630,8 +624,8 @@
     </entry>
     <entry file="file://$PROJECT_DIR$/todo/settings.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="386">
-          <caret line="57" column="8" lean-forward="false" selection-start-line="55" selection-start-column="3" selection-end-line="57" selection-end-column="8" />
+        <state relative-caret-position="338">
+          <caret line="59" column="0" lean-forward="true" selection-start-line="59" selection-start-column="0" selection-end-line="59" selection-end-column="0" />
           <folding />
         </state>
       </provider>

+ 1 - 0
requirements.txt

@@ -1,4 +1,5 @@
 Django==1.10
+django-cors-headers==2.1.0
 djangorestframework==3.6.3
 djangorestframework-bulk==0.2.1
 PyMySQL==0.7.9

+ 6 - 0
todo/settings.py

@@ -27,6 +27,7 @@ DEBUG = True
 ALLOWED_HOSTS = []
 
 import pymysql;
+
 pymysql.install_as_MySQLdb()
 
 # Application definition
@@ -40,6 +41,7 @@ INSTALLED_APPS = [
     'django.contrib.staticfiles',
     'api.task',
     'rest_framework',
+    'corsheaders',
 ]
 
 MIDDLEWARE = [
@@ -50,8 +52,12 @@ MIDDLEWARE = [
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware',
     'django.middleware.clickjacking.XFrameOptionsMiddleware',
+    'corsheaders.middleware.CorsMiddleware',
+    'django.middleware.common.CommonMiddleware',
 ]
 
+CORS_ORIGIN_ALLOW_ALL = True
+
 REST_FRAMEWORK = {
     # 'DEFAULT_PERMISSION_CLASSES': [
     #     'rest_framework.permissions.IsAdminUser',

BIN
todo/settings.pyc