我在VB Linux Red Hat中使用django。 我尝试过使用命令
python manage.py runserver - 192.168.1.100:8000
为了访问我的网站。它一直工作到现在,但后来它给我看了这个消息:
manage.py runserver: error: unrecognized arguments: 192.168.1.100:8000
我认为这与settings.py
文件有关,我无法记住我在那里发生了什么变化。
以下是settings.py
的内容:
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'o-g4ql*yum(+ollra+t%1x)$svtr!sd7mrcv=lj@_p&hrbq_&z'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = ['192.168.1.100']
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'myapp',
)
MIDDLEWARE_CLASSES = (
'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 = 'mysite.urls'
WSGI_APPLICATION = 'mysite.wsgi.application'
# Database
# https://docs.djangoproject.com/en/dev/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/dev/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/dev/howto/static-files/
STATIC_URL = '/static/'
谢谢!
答案 0 :(得分:1)
这不是设置文件。您不需要命令中的破折号:它应该只是python manage.py runserver 192.168.1.100:8000
。
答案 1 :(得分:1)
删除命令中的破折号(-
):
python manage.py - runserver 192.168.1.100:8000
得到:
python manage.py runserver 192.168.1.100:8000