当我在Ubuntu 16.04 VPS机器上运行python3 manage.py runserver
时,它对我的项目没有任何作用,但它在我的计算机上运行。
我尝试运行python3 -v manage.py runserver
,并看到它在执行以下命令时停止:
# code object from '/usr/lib/python3.5/site-packages/OpenSSL/__pycache__/SSL.cpython-35.pyc'
import 'OpenSSL.SSL' # <_frozen_importlib_external.SourceFileLoader object at 0x2b1d1d937630>
# /usr/lib/python3.5/site-packages/OpenSSL/__pycache__/version.cpython-35.pyc matches /usr/lib/python3.5/site-packages/OpenSSL/version.py
# code object from '/usr/lib/python3.5/site-packages/OpenSSL/__pycache__/version.cpython-35.pyc'
import 'OpenSSL.version' # <_frozen_importlib_external.SourceFileLoader object at 0x2b1d1e6a5c50>
import 'OpenSSL' # <_frozen_importlib_external.SourceFileLoader object at 0x2b1d1d923da0>
在最后一行之后,它开始什么都不做
my settings.py文件:
"""
Django settings for hahachat project.
Generated by 'django-admin startproject' using Django 3.0.4.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '............'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['localhost']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_extensions',
'main',
'rest_framework',
'rest_framework.authtoken',
'corsheaders',
'djoser',
'channels',
'room',
'chat',
'game',
'living_room',
'api',
]
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'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 = 'hahachat.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'hahachat/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',
],
},
},
]
os.environ['REDIS_URL'] = 'redis://h:p86b9c0868bee0a41b875b4ea3c31db8dd8744d988a6ab8678936814a3e09e93a@ec2-54-82-84-36.compute-1.amazonaws.com:13629'
WSGI_APPLICATION = 'hahachat.wsgi.application'
ASGI_APPLICATION = 'hahachat.routing.application'
CHANNEL_LAYERS = {
'default': {
'BACKEND': 'channels_redis.core.RedisChannelLayer',
# 'BACKEND': 'asgi_redis.RedisChannelLayer',
'CONFIG': {
"hosts": [
# ('redis://:admin@redis-19717.c74.us-east-1-4.ec2.cloud.redislabs.com', 19717),
# ('redis://h:p86b9c0868bee0a41b875b4ea3c31db8dd8744d988a6ab8678936814a3e09e93a@ec2-54-82-84-36.compute-1.amazonaws.com', 13629),
# ('ec2-54-82-84-36.compute-1.amazonaws.com', 13629)
# ('127.0.0.1', 6379),
os.environ.get('REDIS_URL', 'redis://redis:6379')
],
},
},
}
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'mydatabase',
}
}
# Password validation
# https://docs.djangoproject.com/en/3.0/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.0/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'hahachat/static/'),
]
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'hahachat/media/')
AUTH_USER_MODEL = 'main.HahaUser'
CORS_ORIGIN_ALLOW_ALL = True
CORS_URLS_REGEX = r'^/api/.*$'
PASSWORD_HASHERS = [
'django.contrib.auth.hashers.Argon2PasswordHasher',
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
]
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_USE_TLS = True
EMAIL_PORT = 587
EMAIL_HOST_USER = 'No-no-no:)' # change it for stackoveflow
EMAIL_HOST_PASSWORD = 'No-no-no:)' # change it for stackoveflow
# rest framework confuguration
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.TokenAuthentication',
),
'DEFAULT_PERMISSIONS_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
),
}
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
PROJECT_ROOT = os.path.join(os.path.abspath(__file__))
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'
# Extra lookup directories for collectstatic to find static files
STATICFILES_DIRS = (
os.path.join(PROJECT_ROOT, 'static'),
)
# Add configuration for static files storage using whitenoise
# STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
我试图创建另一个项目,但它运行得很完美,所以问题出在我的项目中,你能帮我吗?(
UPD-
现在,当我尝试做pip3 list
时,它也依赖于导入密码模块
import 'cryptography.hazmat.primitives.kdf.scrypt' # <_frozen_importlib_external.SourceFileLoader object at 0x2ac73f3a9588>
通过删除导致问题的文件来修复它。