我有一个Django(1.9.1)项目工作正常,直到我将Google Calendar API文档提供的代码添加到我的某个应用程序中.
当我在独立模式下运行时,此代码在我的虚拟环境中也能正常工作,但是当我尝试使用Django项目中的代码时,我在运行"python manage.py runserver"时收到此消息:
./manage.py runserver
Performing system checks...
usage: manage.py [-h] [--auth_host_name AUTH_HOST_NAME]
[--noauth_local_webserver]
[--auth_host_port [AUTH_HOST_PORT [AUTH_HOST_PORT ...]]]
[--logging_level {DEBUG,INFO,WARNING,ERROR,CRITICAL}]
manage.py: error: unrecognized arguments: runserver
Run Code Online (Sandbox Code Playgroud)
当我尝试运行makemigrations或迁移时,也会发生此错误.
显然错误告诉我该怎么做,但我真的不明白.
为了安全起见,这是我试图运行的代码:
from __future__ import print_function
import httplib2
import os
from apiclient import discovery
import oauth2client
from oauth2client import client
from oauth2client import tools
try:
import argparse
flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args()
except ImportError:
flags = None
SCOPES = 'https://www.googleapis.com/auth/calendar'
CLIENT_SECRET_FILE = 'client_secret.json'
APPLICATION_NAME = 'Google Calendar …Run Code Online (Sandbox Code Playgroud)