Compare commits
48 Commits
SpiderWebs
...
master
@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/../../../../../:\Project Files\djangoProject\SpiderWebsite\.idea/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="django" name="Django">
|
||||||
|
<configuration>
|
||||||
|
<option name="rootFolder" value="$MODULE_DIR$" />
|
||||||
|
<option name="settingsModule" value="SpiderWebsite/settings.py" />
|
||||||
|
<option name="manageScript" value="$MODULE_DIR$/manage.py" />
|
||||||
|
<option name="environment" value="<map/>" />
|
||||||
|
<option name="doNotUseTestRunner" value="false" />
|
||||||
|
<option name="trackFilePattern" value="migrations" />
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
<component name="TemplatesService">
|
||||||
|
<option name="TEMPLATE_CONFIGURATION" value="Django" />
|
||||||
|
<option name="TEMPLATE_FOLDERS">
|
||||||
|
<list>
|
||||||
|
<option value="$MODULE_DIR$/../SpiderWebsite\templates" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</module>
|
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="dataSourceStorageLocal">
|
||||||
|
<data-source name="python_web_spider_DB@192.168.137.132" uuid="a054a47b-8b8c-4cc9-bfc8-0ff4ab7fd9f8">
|
||||||
|
<database-info product="MariaDB" version="10.3.27-MariaDB-0+deb10u1" jdbc-version="4.2" driver-name="MariaDB Connector/J" driver-version="2.6.0" dbms="MARIADB" exact-version="10.3.27" exact-driver-version="2.6">
|
||||||
|
<extra-name-characters>#@</extra-name-characters>
|
||||||
|
<identifier-quote-string>`</identifier-quote-string>
|
||||||
|
</database-info>
|
||||||
|
<case-sensitivity plain-identifiers="exact" quoted-identifiers="exact" />
|
||||||
|
<secret-storage>master_key</secret-storage>
|
||||||
|
<user-name>student</user-name>
|
||||||
|
<schema-mapping>
|
||||||
|
<introspection-scope>
|
||||||
|
<node kind="schema" qname="@" />
|
||||||
|
</introspection-scope>
|
||||||
|
</schema-mapping>
|
||||||
|
</data-source>
|
||||||
|
<data-source name="python_web_spider_DB@120.79.165.140" uuid="fd60bcf9-001b-4c4a-990f-1e1c3de177de">
|
||||||
|
<database-info product="MariaDB" version="10.3.28-MariaDB" jdbc-version="4.2" driver-name="MariaDB Connector/J" driver-version="2.6.0" dbms="MARIADB" exact-version="10.3.28" exact-driver-version="2.6">
|
||||||
|
<extra-name-characters>#@</extra-name-characters>
|
||||||
|
<identifier-quote-string>`</identifier-quote-string>
|
||||||
|
</database-info>
|
||||||
|
<case-sensitivity plain-identifiers="exact" quoted-identifiers="exact" />
|
||||||
|
<secret-storage>master_key</secret-storage>
|
||||||
|
<user-name>kino</user-name>
|
||||||
|
<schema-mapping>
|
||||||
|
<introspection-scope>
|
||||||
|
<node kind="schema" qname="@" />
|
||||||
|
</introspection-scope>
|
||||||
|
</schema-mapping>
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
|
<data-source source="LOCAL" name="python_web_spider_DB@192.168.137.132" uuid="a054a47b-8b8c-4cc9-bfc8-0ff4ab7fd9f8">
|
||||||
|
<driver-ref>mariadb</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:mariadb://192.168.137.132:3306/python_web_spider_DB</jdbc-url>
|
||||||
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
|
</data-source>
|
||||||
|
<data-source source="LOCAL" name="python_web_spider_DB@120.79.165.140" uuid="fd60bcf9-001b-4c4a-990f-1e1c3de177de">
|
||||||
|
<driver-ref>mariadb</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:mariadb://120.79.165.140:3306/python_web_spider_DB</jdbc-url>
|
||||||
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (SpiderWebsite)" project-jdk-type="Python SDK" />
|
||||||
|
</project>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/SpiderWebsite.iml" filepath="$PROJECT_DIR$/.idea/SpiderWebsite.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,153 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AutoImportSettings">
|
||||||
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
|
</component>
|
||||||
|
<component name="ChangeListManager">
|
||||||
|
<list default="true" id="a341f3cd-864c-4b0c-83de-625b347a6afe" name="Default Changelist" comment="" />
|
||||||
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
|
</component>
|
||||||
|
<component name="DjangoConsoleOptions" custom-start-script="import sys; print('Python %s on %s' % (sys.version, sys.platform)) import django; print('Django %s' % django.get_version()) sys.path.extend([WORKING_DIR_AND_PYTHON_PATHS]) if 'setup' in dir(django): django.setup() import django_manage_shell; django_manage_shell.run(PROJECT_ROOT)">
|
||||||
|
<option name="myCustomStartScript" value="import sys; print('Python %s on %s' % (sys.version, sys.platform)) import django; print('Django %s' % django.get_version()) sys.path.extend([WORKING_DIR_AND_PYTHON_PATHS]) if 'setup' in dir(django): django.setup() import django_manage_shell; django_manage_shell.run(PROJECT_ROOT)" />
|
||||||
|
</component>
|
||||||
|
<component name="FileTemplateManagerImpl">
|
||||||
|
<option name="RECENT_TEMPLATES">
|
||||||
|
<list>
|
||||||
|
<option value="HTML File" />
|
||||||
|
<option value="Python Script" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="GitSEFilterConfiguration">
|
||||||
|
<file-type-list>
|
||||||
|
<filtered-out-file-type name="LOCAL_BRANCH" />
|
||||||
|
<filtered-out-file-type name="REMOTE_BRANCH" />
|
||||||
|
<filtered-out-file-type name="TAG" />
|
||||||
|
<filtered-out-file-type name="COMMIT_BY_MESSAGE" />
|
||||||
|
</file-type-list>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectId" id="1sfThon3Q1JQhsNZgPY7aHaFGuC" />
|
||||||
|
<component name="ProjectViewState">
|
||||||
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
|
<option name="showLibraryContents" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="PropertiesComponent">
|
||||||
|
<property name="DatabaseDriversLRU" value="mongo mariadb" />
|
||||||
|
<property name="DefaultHtmlFileTemplate" value="HTML File" />
|
||||||
|
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||||
|
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||||
|
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||||
|
<property name="database.data.extractors.current.export.id" value="Comma-separated (CSV)_id" />
|
||||||
|
<property name="last_opened_file_path" value="$PROJECT_DIR$/demo/templates" />
|
||||||
|
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
|
||||||
|
</component>
|
||||||
|
<component name="RecentsManager">
|
||||||
|
<key name="CopyFile.RECENT_KEYS">
|
||||||
|
<recent name="E:\Project Files\djangoProject\SpiderWebsite\demo\templates" />
|
||||||
|
<recent name="E:\Project Files\djangoProject\SpiderWebsite\demo" />
|
||||||
|
</key>
|
||||||
|
</component>
|
||||||
|
<component name="RunManager" selected="Django Server.SpiderWebsite">
|
||||||
|
<configuration name="test" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||||
|
<module name="SpiderWebsite" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<envs>
|
||||||
|
<env name="PYTHONUNBUFFERED" value="1" />
|
||||||
|
</envs>
|
||||||
|
<option name="SDK_HOME" value="" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/demo" />
|
||||||
|
<option name="IS_MODULE_SDK" value="true" />
|
||||||
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
|
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||||
|
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/demo/test.py" />
|
||||||
|
<option name="PARAMETERS" value="" />
|
||||||
|
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||||
|
<option name="EMULATE_TERMINAL" value="false" />
|
||||||
|
<option name="MODULE_MODE" value="false" />
|
||||||
|
<option name="REDIRECT_INPUT" value="false" />
|
||||||
|
<option name="INPUT_FILE" value="" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
<configuration name="views" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||||
|
<module name="SpiderWebsite" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<envs>
|
||||||
|
<env name="PYTHONUNBUFFERED" value="1" />
|
||||||
|
</envs>
|
||||||
|
<option name="SDK_HOME" value="" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/demo" />
|
||||||
|
<option name="IS_MODULE_SDK" value="true" />
|
||||||
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
|
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||||
|
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/demo/views.py" />
|
||||||
|
<option name="PARAMETERS" value="" />
|
||||||
|
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||||
|
<option name="EMULATE_TERMINAL" value="false" />
|
||||||
|
<option name="MODULE_MODE" value="false" />
|
||||||
|
<option name="REDIRECT_INPUT" value="false" />
|
||||||
|
<option name="INPUT_FILE" value="" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
<configuration name="SpiderWebsite" type="Python.DjangoServer" factoryName="Django server">
|
||||||
|
<module name="SpiderWebsite" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<envs>
|
||||||
|
<env name="PYTHONUNBUFFERED" value="1" />
|
||||||
|
<env name="DJANGO_SETTINGS_MODULE" value="SpiderWebsite.settings" />
|
||||||
|
</envs>
|
||||||
|
<option name="SDK_HOME" value="" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="" />
|
||||||
|
<option name="IS_MODULE_SDK" value="false" />
|
||||||
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
|
<option name="launchJavascriptDebuger" value="false" />
|
||||||
|
<option name="port" value="8000" />
|
||||||
|
<option name="host" value="" />
|
||||||
|
<option name="additionalOptions" value="" />
|
||||||
|
<option name="browserUrl" value="" />
|
||||||
|
<option name="runTestServer" value="false" />
|
||||||
|
<option name="runNoReload" value="false" />
|
||||||
|
<option name="useCustomRunCommand" value="false" />
|
||||||
|
<option name="customRunCommand" value="" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
<recent_temporary>
|
||||||
|
<list>
|
||||||
|
<item itemvalue="Python.test" />
|
||||||
|
<item itemvalue="Python.views" />
|
||||||
|
</list>
|
||||||
|
</recent_temporary>
|
||||||
|
</component>
|
||||||
|
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||||
|
<component name="TaskManager">
|
||||||
|
<task active="true" id="Default" summary="Default task">
|
||||||
|
<changelist id="a341f3cd-864c-4b0c-83de-625b347a6afe" name="Default Changelist" comment="" />
|
||||||
|
<created>1621262767587</created>
|
||||||
|
<option name="number" value="Default" />
|
||||||
|
<option name="presentableId" value="Default" />
|
||||||
|
<updated>1621262767587</updated>
|
||||||
|
<workItem from="1621262826270" duration="880000" />
|
||||||
|
<workItem from="1621326333045" duration="13064000" />
|
||||||
|
<workItem from="1621344108782" duration="5102000" />
|
||||||
|
<workItem from="1621383590355" duration="25305000" />
|
||||||
|
<workItem from="1621499387217" duration="19227000" />
|
||||||
|
<workItem from="1621555699345" duration="10184000" />
|
||||||
|
</task>
|
||||||
|
<servers />
|
||||||
|
</component>
|
||||||
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
|
<option name="version" value="3" />
|
||||||
|
</component>
|
||||||
|
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
||||||
|
<SUITE FILE_PATH="coverage/SpiderWebsite$test.coverage" NAME="test Coverage Results" MODIFIED="1621556586504" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/demo" />
|
||||||
|
<SUITE FILE_PATH="coverage/SpiderWebsite$views.coverage" NAME="views Coverage Results" MODIFIED="1621430291321" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/demo" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,16 @@
|
|||||||
|
"""
|
||||||
|
ASGI config for SpiderWebsite project.
|
||||||
|
|
||||||
|
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from django.core.asgi import get_asgi_application
|
||||||
|
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'SpiderWebsite.settings')
|
||||||
|
|
||||||
|
application = get_asgi_application()
|
@ -0,0 +1,127 @@
|
|||||||
|
"""
|
||||||
|
Django settings for SpiderWebsite project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 3.2.3.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/3.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/3.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
|
|
||||||
|
# Quick-start development settings - unsuitable for production
|
||||||
|
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = 'django-insecure-w)+=_o^@7=*$q74ts!62onk$skg13%jgzmnpsy764btg6osqt@'
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = False
|
||||||
|
# 请求头HOST
|
||||||
|
ALLOWED_HOSTS = ['*']
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'demo.apps.DemoConfig',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'SpiderWebsite.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [BASE_DIR / 'templates']
|
||||||
|
,
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.debug',
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'SpiderWebsite.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': BASE_DIR / 'db.sqlite3',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/3.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'zh-Hans'
|
||||||
|
|
||||||
|
TIME_ZONE = 'Asia/Shanghai'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_L10N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/3.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = '/static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
@ -0,0 +1,22 @@
|
|||||||
|
"""SpiderWebsite URL Configuration
|
||||||
|
|
||||||
|
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||||
|
https://docs.djangoproject.com/en/3.2/topics/http/urls/
|
||||||
|
Examples:
|
||||||
|
Function views
|
||||||
|
1. Add an import: from my_app import views
|
||||||
|
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||||
|
Class-based views
|
||||||
|
1. Add an import: from other_app.views import Home
|
||||||
|
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||||
|
Including another URLconf
|
||||||
|
1. Import the include() function: from django.urls import include, path
|
||||||
|
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||||
|
"""
|
||||||
|
from django.contrib import admin
|
||||||
|
from django.urls import path, include
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('admin/', admin.site.urls),
|
||||||
|
path(r'', include('demo.urls')),
|
||||||
|
]
|
@ -0,0 +1,16 @@
|
|||||||
|
"""
|
||||||
|
WSGI config for SpiderWebsite project.
|
||||||
|
|
||||||
|
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'SpiderWebsite.settings')
|
||||||
|
|
||||||
|
application = get_wsgi_application()
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,3 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
@ -0,0 +1,6 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class DemoConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'demo'
|
Binary file not shown.
@ -0,0 +1,3 @@
|
|||||||
|
from django.db import models
|
||||||
|
|
||||||
|
# Create your models here.
|
@ -0,0 +1,13 @@
|
|||||||
|
{% import 'macro' as macro %}
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>{{ chart.page_title }}</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
{{ macro.gen_components_content(chart) }}
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>爬爬虫的Small Home</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!--这是一个注释,注释在浏览器中不会显示-->
|
||||||
|
<h1>这是主页</h1>
|
||||||
|
<!--hr 标签定义水平线:-->
|
||||||
|
<hr />
|
||||||
|
<a href="table_one">北京新发地菜市场产品种类分析</a>
|
||||||
|
<hr />
|
||||||
|
<a href="pie_one">豆瓣电影排行top250年份分布</a>
|
||||||
|
<hr />
|
||||||
|
<a href="word_cloud">网易云评论词云</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,195 @@
|
|||||||
|
{%- macro render_chart_content(c) -%}
|
||||||
|
<div id="{{ c.chart_id }}" class="chart-container" style="width:{{ c.width }}; height:{{ c.height }};"></div>
|
||||||
|
<script>
|
||||||
|
var chart_{{ c.chart_id }} = echarts.init(
|
||||||
|
document.getElementById('{{ c.chart_id }}'), '{{ c.theme }}', {renderer: '{{ c.renderer }}'});
|
||||||
|
{% for js in c.js_functions.items %}
|
||||||
|
{{ js }}
|
||||||
|
{% endfor %}
|
||||||
|
var option_{{ c.chart_id }} = {{ c.json_contents }};
|
||||||
|
chart_{{ c.chart_id }}.setOption(option_{{ c.chart_id }});
|
||||||
|
{% if c._is_geo_chart %}
|
||||||
|
var bmap = chart_{{ c.chart_id }}.getModel().getComponent('bmap').getBMap();
|
||||||
|
{% if c.bmap_js_functions %}
|
||||||
|
{% for fn in c.bmap_js_functions.items %}
|
||||||
|
{{ fn }}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% if c.width.endswith('%') %}
|
||||||
|
window.addEventListener('resize', function(){
|
||||||
|
chart_{{ c.chart_id }}.resize();
|
||||||
|
})
|
||||||
|
{% endif %}
|
||||||
|
</script>
|
||||||
|
{%- endmacro %}
|
||||||
|
|
||||||
|
{%- macro render_notebook_charts(charts, libraries) -%}
|
||||||
|
<script>
|
||||||
|
require([{{ libraries | join(', ') }}], function(echarts) {
|
||||||
|
{% for c in charts %}
|
||||||
|
{% if c._component_type not in ("table", "image") %}
|
||||||
|
var chart_{{ c.chart_id }} = echarts.init(
|
||||||
|
document.getElementById('{{ c.chart_id }}'), '{{ c.theme }}', {renderer: '{{ c.renderer }}'});
|
||||||
|
{% for js in c.js_functions.items %}
|
||||||
|
{{ js }}
|
||||||
|
{% endfor %}
|
||||||
|
var option_{{ c.chart_id }} = {{ c.json_contents }};
|
||||||
|
chart_{{ c.chart_id }}.setOption(option_{{ c.chart_id }});
|
||||||
|
{% if c._is_geo_chart %}
|
||||||
|
var bmap = chart_{{ c.chart_id }}.getModel().getComponent('bmap').getBMap();
|
||||||
|
bmap.addControl(new BMap.MapTypeControl());
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{%- endmacro %}
|
||||||
|
|
||||||
|
{%- macro render_chart_dependencies(c) -%}
|
||||||
|
{% for dep in c.dependencies %}
|
||||||
|
<script type="text/javascript" src="{{ dep }}"></script>
|
||||||
|
{% endfor %}
|
||||||
|
{%- endmacro %}
|
||||||
|
|
||||||
|
{%- macro render_chart_css(c) -%}
|
||||||
|
{% for dep in c.css_libs %}
|
||||||
|
<link rel="stylesheet" href="{{ dep }}">
|
||||||
|
{% endfor %}
|
||||||
|
{%- endmacro %}
|
||||||
|
|
||||||
|
{%- macro display_tablinks(chart) -%}
|
||||||
|
<div class="tab">
|
||||||
|
{% for c in chart %}
|
||||||
|
<button class="tablinks" onclick="showChart(event, '{{ c.chart_id }}')">{{ c.tab_name }}</button>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{%- endmacro %}
|
||||||
|
|
||||||
|
{%- macro switch_tabs() -%}
|
||||||
|
<script>
|
||||||
|
(function() {
|
||||||
|
containers = document.getElementsByClassName("chart-container");
|
||||||
|
if(containers.length > 0) {
|
||||||
|
containers[0].style.display = "block";
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
|
||||||
|
function showChart(evt, chartID) {
|
||||||
|
let containers = document.getElementsByClassName("chart-container");
|
||||||
|
for (let i = 0; i < containers.length; i++) {
|
||||||
|
containers[i].style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
let tablinks = document.getElementsByClassName("tablinks");
|
||||||
|
for (let i = 0; i < tablinks.length; i++) {
|
||||||
|
tablinks[i].className = "tablinks";
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById(chartID).style.display = "block";
|
||||||
|
evt.currentTarget.className += " active";
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{%- endmacro %}
|
||||||
|
|
||||||
|
{%- macro generate_tab_css() %}
|
||||||
|
<style>
|
||||||
|
.tab {
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
background-color: #f1f1f1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab button {
|
||||||
|
background-color: inherit;
|
||||||
|
float: left;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 12px 16px;
|
||||||
|
transition: 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab button:hover {
|
||||||
|
background-color: #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab button.active {
|
||||||
|
background-color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-container {
|
||||||
|
display: none;
|
||||||
|
padding: 6px 12px;
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{%- endmacro %}
|
||||||
|
|
||||||
|
{%- macro gen_components_content(chart) %}
|
||||||
|
{% if chart._component_type == "table" %}
|
||||||
|
<style>
|
||||||
|
.fl-table {
|
||||||
|
margin: 20px;
|
||||||
|
border-radius: 5px;
|
||||||
|
font-size: 12px;
|
||||||
|
border: none;
|
||||||
|
border-collapse: collapse;
|
||||||
|
max-width: 100%;
|
||||||
|
white-space: nowrap;
|
||||||
|
word-break: keep-all;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fl-table th {
|
||||||
|
text-align: left;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fl-table tr {
|
||||||
|
display: table-row;
|
||||||
|
vertical-align: inherit;
|
||||||
|
border-color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fl-table tr:hover td {
|
||||||
|
background: #00d1b2;
|
||||||
|
color: #F8F8F8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fl-table td, .fl-table th {
|
||||||
|
border-style: none;
|
||||||
|
border-top: 1px solid #dbdbdb;
|
||||||
|
border-left: 1px solid #dbdbdb;
|
||||||
|
border-bottom: 3px solid #dbdbdb;
|
||||||
|
border-right: 1px solid #dbdbdb;
|
||||||
|
padding: .5em .55em;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fl-table td {
|
||||||
|
border-style: none;
|
||||||
|
font-size: 15px;
|
||||||
|
vertical-align: center;
|
||||||
|
border-bottom: 1px solid #dbdbdb;
|
||||||
|
border-left: 1px solid #dbdbdb;
|
||||||
|
border-right: 1px solid #dbdbdb;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fl-table tr:nth-child(even) {
|
||||||
|
background: #F8F8F8;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div id="{{ chart.chart_id }}" class="chart-container" style="">
|
||||||
|
<p class="title" {{ chart.title_opts.title_style }}> {{ chart.title_opts.title }}</p>
|
||||||
|
<p class="subtitle" {{ chart.title_opts.subtitle_style }}> {{ chart.title_opts.subtitle }}</p>
|
||||||
|
{{ chart.html_content }}
|
||||||
|
</div>
|
||||||
|
{% elif chart._component_type == "image" %}
|
||||||
|
<div id="{{ chart.chart_id }}" class="chart-container" style="">
|
||||||
|
<p class="title" {{ chart.title_opts.title_style }}> {{ chart.title_opts.title }}</p>
|
||||||
|
<p class="subtitle" {{ chart.title_opts.subtitle_style }}> {{ chart.title_opts.subtitle }}</p>
|
||||||
|
<img {{ chart.html_content }}/>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{%- endmacro %}
|
@ -0,0 +1,15 @@
|
|||||||
|
{% import 'macro' as macro %}
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<!--<title>{{ chart.page_title }}</title>-->
|
||||||
|
<title>北京新发地菜市场产品种类分析</title>
|
||||||
|
{{ macro.render_chart_dependencies(chart) }}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{{ macro.render_chart_content(chart) }}
|
||||||
|
<hr />
|
||||||
|
<a href="home">回到主页</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,14 @@
|
|||||||
|
{% import 'macro' as macro %}
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>网易云歌曲评论词云</title>
|
||||||
|
{{ macro.render_chart_dependencies(chart) }}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{{ macro.render_chart_content(chart) }}
|
||||||
|
<hr />
|
||||||
|
<a href="home">回到主页</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,15 @@
|
|||||||
|
{% import 'macro' as macro %}
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>豆瓣电影排行top250年份分布</title>
|
||||||
|
{{ macro.render_chart_dependencies(chart) }}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<hr />
|
||||||
|
{{ macro.render_chart_content(chart) }}
|
||||||
|
<hr />
|
||||||
|
<a href="home">回到主页</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,3 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
@ -0,0 +1,14 @@
|
|||||||
|
from django.urls import path, include, re_path
|
||||||
|
|
||||||
|
from demo import views
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path(r'', views.home),
|
||||||
|
# <int:page>传参数到后面的views
|
||||||
|
path(r'page<int:page>', views.page_views),
|
||||||
|
path(r'home', views.home),
|
||||||
|
path(r'table_one', views.table_one),
|
||||||
|
path(r'pie_one', views.pie_views),
|
||||||
|
path(r'word_cloud', views.word_cloud),
|
||||||
|
# re_path(r'^$', views.table_one),
|
||||||
|
]
|
@ -0,0 +1,141 @@
|
|||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<!--<title>Awesome-pyecharts</title>-->
|
||||||
|
<title>数据分析</title>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="https://assets.pyecharts.org/assets/echarts.min.js"></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="1f2015dbd84b47fc95b04be607d3b1c0" class="chart-container" style="width:900px; height:500px;"></div>
|
||||||
|
<script>
|
||||||
|
var chart_1f2015dbd84b47fc95b04be607d3b1c0 = echarts.init(
|
||||||
|
document.getElementById('1f2015dbd84b47fc95b04be607d3b1c0'), 'white', {renderer: 'canvas'});
|
||||||
|
|
||||||
|
var option_1f2015dbd84b47fc95b04be607d3b1c0 = {
|
||||||
|
"animation": true,
|
||||||
|
"animationThreshold": 2000,
|
||||||
|
"animationDuration": 1000,
|
||||||
|
"animationEasing": "cubicOut",
|
||||||
|
"animationDelay": 0,
|
||||||
|
"animationDurationUpdate": 300,
|
||||||
|
"animationEasingUpdate": "cubicOut",
|
||||||
|
"animationDelayUpdate": 0,
|
||||||
|
"color": [
|
||||||
|
"blue",
|
||||||
|
"green",
|
||||||
|
"yellow",
|
||||||
|
"red",
|
||||||
|
"pink",
|
||||||
|
"orange",
|
||||||
|
"purple"
|
||||||
|
],
|
||||||
|
"series": [
|
||||||
|
{
|
||||||
|
"type": "pie",
|
||||||
|
"clockwise": true,
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"name": "\u8349\u8393",
|
||||||
|
"value": 42
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "\u8292\u679c",
|
||||||
|
"value": 114
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "\u8461\u8404",
|
||||||
|
"value": 99
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "\u96ea\u68a8",
|
||||||
|
"value": 60
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "\u897f\u74dc",
|
||||||
|
"value": 81
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "\u67e0\u6aac",
|
||||||
|
"value": 83
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "\u8f66\u5398\u5b50",
|
||||||
|
"value": 86
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"radius": [
|
||||||
|
"0%",
|
||||||
|
"75%"
|
||||||
|
],
|
||||||
|
"center": [
|
||||||
|
"50%",
|
||||||
|
"50%"
|
||||||
|
],
|
||||||
|
"label": {
|
||||||
|
"show": true,
|
||||||
|
"position": "top",
|
||||||
|
"margin": 8,
|
||||||
|
"formatter": "{b}: {c}"
|
||||||
|
},
|
||||||
|
"rippleEffect": {
|
||||||
|
"show": true,
|
||||||
|
"brushType": "stroke",
|
||||||
|
"scale": 2.5,
|
||||||
|
"period": 4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"legend": [
|
||||||
|
{
|
||||||
|
"data": [
|
||||||
|
"\u8349\u8393",
|
||||||
|
"\u8292\u679c",
|
||||||
|
"\u8461\u8404",
|
||||||
|
"\u96ea\u68a8",
|
||||||
|
"\u897f\u74dc",
|
||||||
|
"\u67e0\u6aac",
|
||||||
|
"\u8f66\u5398\u5b50"
|
||||||
|
],
|
||||||
|
"selected": {},
|
||||||
|
"show": true,
|
||||||
|
"padding": 5,
|
||||||
|
"itemGap": 10,
|
||||||
|
"itemWidth": 25,
|
||||||
|
"itemHeight": 14
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tooltip": {
|
||||||
|
"show": true,
|
||||||
|
"trigger": "item",
|
||||||
|
"triggerOn": "mousemove|click",
|
||||||
|
"axisPointer": {
|
||||||
|
"type": "line"
|
||||||
|
},
|
||||||
|
"showContent": true,
|
||||||
|
"alwaysShowContent": false,
|
||||||
|
"showDelay": 0,
|
||||||
|
"hideDelay": 100,
|
||||||
|
"textStyle": {
|
||||||
|
"fontSize": 14
|
||||||
|
},
|
||||||
|
"borderWidth": 0,
|
||||||
|
"padding": 5
|
||||||
|
},
|
||||||
|
"title": [
|
||||||
|
{
|
||||||
|
"text": "Pie-\u8bbe\u7f6e\u989c\u8272",
|
||||||
|
"padding": 5,
|
||||||
|
"itemGap": 10
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
chart_1f2015dbd84b47fc95b04be607d3b1c0.setOption(option_1f2015dbd84b47fc95b04be607d3b1c0);
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue