This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// importing http | |
const http = require('http'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# firstapp/views.py | |
from django.shortcuts import render | |
def hello(request): | |
context = {} | |
return render(request, 'firstapp/index.html', context) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--File path: templates/firstapp/index.html --> | |
{% load static %} | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Hello world webapp</title> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* file path: mysite/static/css/main.css */ | |
body { | |
font-family: Arial; | |
background: #1abc9c; | |
margin: 0; | |
} | |
.header { | |
text-align: center; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--File path: templates/firstapp/index.html --> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Hello world webapp</title> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mysite/urls.py | |
from django.contrib import admin | |
from django.urls import include, path | |
urlpatterns = [ | |
path('', include('firstapp.urls')), | |
path('admin/', admin.site.urls), | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#File path: firstapp/urls.py | |
from django.urls import path | |
from . import views | |
urlpatterns = [ | |
path('', views.hello, name='hello'), | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# firstapp/views.py | |
from django.http import HttpResponse | |
def hello(request): | |
return HttpResponse("Hello world") |