django project, set up public network access

Local access request method:

python manage.py runserver
python manage.py runserver 127.0.0.1:8000

 

Public Internet access request method:

Create a mysite project

django-admin startproject mysite

First,
modify the language to be the time zone

vim mysite/mysite/settings.py


LANGUAGE_CODE = 'zh-hans'
TIME_ZONE = 'Asia/Shanghai'
 

 Modify the database:

```

DATABASES = {
    'default': {
        #'ENGINE': 'django.db.backends.sqlite3',
        #'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

 


Development server

After runserver is added to make other computers accessible, I developed it on a linux server and accessed it on a windows computer

Run python  manage.py  runserver 0.0.0.0:8000, Django will think it is access from the public network

Guess you like

Origin blog.csdn.net/Growing_hacker/article/details/102469841