1. For creating templates just create new folder called 'templates' in your project, where we will save all html templates
2. Now go in settings folder and in templates section, add name 'templates' in DIRS like shown in fig.,
3. Create new html page file in templates folder name as 'navbar.html' & ''home.html' which will use for creating navigation bar in all our templates.
4.
In navbar.html, navigation bar for our website which will be created using bootstrap.
In home.html, Homepage code should be like,
5.Now create urls.py file in your 'hospital' (App Name) folder
6. In that urls.py file type below code,
7. Next step is paste following code in views.py file of hospital folder.
8. In main urls.py(shown in following image) add your app name like following,
in this file add your code as,
also django.urls should be like this,
i.e import 'include' library
9. Finally main urls.py file should look like,
10. First of all make sure that you are on virtual environment.
command for that is,
workon test
11. Then now run migrations command that is,
python manage.py migrate
you will see all migrations are done in sqlite server
12. For running server, type command and press enter,
python manage.py runserver
Now you will see following if there are no errors in your code
13. Open your browser and type following link address,
http://127.0.0.1:8000
14. Now you will see home page in your browser,
Comments
Post a Comment