Preparing
Python
Django
Html
css
Javascript
Databases
HeroKu
Materialize
Beautiful suite
Web scraping
Starters!
conda create --name codedaddies python=3
|
django-admin startproject codedaddies_list
|
python manage.py startapp my_app
|
python manage.py makemigrations python manage.py migrate
|
配置在settings中,加入以下:
TEMPLATE_DIR = os.path.join(BASE_DIR, “templates”)
底部加入:
STATICFILES_DIR = (os.path.join(BASE_DIR, ‘static’),)
TEMPLATES块中设置DIRS
‘DIRS’: [TEMPLATE_DIR],
注:需要在pycharm中设置templates标志
python manage.py createsuperuser
|
First Page
from . import views
urlpatterns = [ path('', views.home, name='home'), ]
|
def home(request): return render(request, 'base.html')
|
models.py中
class Search(models.Model): search = models.CharField(max_length=500) created = models.DateTimeField(auto_now=True)
|
记得执行migrate操作
from .models import Search
# Register your models here. admin.site.register(Search)
|