Pun I Internal Report
Pun I Internal Report
Submitted by
PUNITH M
U03HA22S0009
Under the guidance of
Mr. KSS Praveen Kumar, M.Tech(Ph.D)
(Department of Computer Applications – BCA)
GUIDE CERTIFICATE
Internal Guide
SHREE VEDHA COLLEGE
Department of Computer Applications - BCA
Internship Day Book
Mr. K.S.S Praveen Kumar Mr. K.S.S Praveen Kumar Dr.K.Dharani Devi
Internal Guide HOD Principal
Shree Vedha College Shree Vedha College Shree Vedha College
WEEKLY OVERVIEW OF INTERNSHIP ACTIVITIES
VS Code, Git
11/02/25 TUESDAY Basic Python Syntax: Variables, Data 1
Types, Loops, Conditionals
12/02/25 WEDNESDAY Type Casting, Input/Output Statements 2
13/02/25 THURSDAY HTML Basics: Tags, Forms, Tables 2
14/02/25 FRIDAY CSS Fundamentals: Selectors, Layouts, 3
Box Model
15/02/25 SATURDAY HTML/CSS Assignments and Practice 3
Basics
19/03/25 WEDNESDAY API Authentication: Token-Based 1
Authentication
20/03/25 THURSDAY Advanced API Features: Pagination, 2
Filtering
21/03/25 FRIDAY Frontend Integration with APIs 1
22/03/25 SATURDAY Assignment: API Integration in Mini 2
Project
DATE DAY NAME OF THE TOPIC/MODULE HOURS
COMPLETED
24/03/25 MONDAY Session Management in Django 1
7th WEEK
Basics)
01/04/25 TUESDAY Component-Based Architecture in React 2
02/04/25 WEDNESDAY State Management in React (useState, 2
useReducer)
03/04/25 THURSDAY Advanced Features in React (Hooks, 2
Context API)
04/04/25 FRIDAY 2
Integration of React with Django Backend
05/04/25 SATURDAY Assignment: Building a Full-Stack React- 1
Django Application
PUNITH M
(U03HA22S0009)
ACKNOWLEDGEMENT
PUNITH M
(U03HA22S0009)
Chapter - 1
Overview of Python Full Stack Development
What is Python?
Python is a popular programming language. It was created by Guido van Rossum, and
released in 1991.
It is used for:
Python Quickstart
Python is an interpreted programming language, this means that as a developer you write
Python (.py) files in a text editor and then put those files into the python interpreter to be
executed.
The way to run a python file is like this on the command line:
Let's write our first Python file, called helloworld.py, which can be done in any text
editor.
helloworld.py
print("Hello, World!")
C:\Users\Your Name>python
Or, if the "python" command did not work, you can try "py":
C:\Users\Your Name>py
From there you can write any python, including our hello world example from earlier in the
tutorial:
C:\Users\Your Name>python
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on
win 32
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello, World!")
C:\Users\Your Name>python
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello, World!")
Hello, World!
Whenever you are done in the python command line, you can simply type the following to
quit the python command line interface:
exit()
IMPLEMENTATION
Implementation Tools
CSS
CSS stands for Cascading Style Sheets. It describes how HTML elements are to be
displayed on screen or in other media. In this project, additional CSS was used when
further customization on the site was required. Sometimes, the theme does not work as per
the requirement of the user so to meet the requirement of the user additional CSS was used.
To add in the icons, to scale the logo properly, change the font size of the specified content,
to add a specific call out box, or style just a section of a post differently CSS was used.
The theme option does provide certain features but to add the features according to the
client’s requirement additional CSS was applied.
JAVASCRIPT
JavaScript (sometimes abbreviated JS) is a prototype-based scripting language that
is dynamic, weakly typed. JavaScript is a client-side scripting language meaning that
JavaScript code written into an HTML page. When a user requests an HTML page with
JavaScript in it, the script is sent to the browser and it's up to the browser to do something
with it. It is used to make webpage more interactive, check or modify the contents of
forms, change images, open new windows and write dynamic page content.
BOOTSTRAP
Bootstrap is a free and open-source CSS framework directed at responsive, mobile-
first frontend web development. It contains CSS- and (optionally) JavaScript-based design
templates for typography, forms, buttons, navigation, and other interface components.
Bootstrap is a web framework that focuses on simplifying the development of informative
web pages (as opposed to web apps). The primary purpose of adding it to a web project is
to apply Bootstrap's choices of colour, size, font and layout to that project. As such, the
primary factor is whether the developers in charge find those choices to their liking. Once
added to a project, Bootstrap provides basic style definitions for all HTML elements. In
addition, developers can take advantage of CSS classes defined in Bootstrap to further
customize the appearance of their contents. For example, Bootstrap has provisioned for
light- and darkcoloured tables, page headings, more prominent pull quotes, and text with a
highlight.
Back End Tools XAMPP
XAMPP is a free and open-source cross-platform web server solution stack package
developed by Apache Friends, consisting mainly of the Apache HTTP Server, MariaDB
database, and interpreters for scripts written in the PHP and Perl programming languages.
Dept of BCA, SHREE VEDHA COLLEGE Page | 3
Since most actual web server deployments use the same components as XAMPP, it makes
transitioning from a local test server to a live server possible. XAMPP's ease of
deployment means a WAMP or LAMP stack can be installed quickly and simply on an
operating system by a developer, with the advantage a number of common add-in
applications such as WordPress and Joomla! can also be installed with similar ease using
Bitnami
PHP
PHP is an amazing and popular language. It is powerful enough to be at the core of
the biggest blogging system on the web. PHP is an acronym for "PHP: Hypertext Pre-
processor". PHP is a widely-used, open source scripting language. PHP scripts are executed
on the server. PHP is free to download and use. PHP files can contain text, HTML, CSS,
JavaScript, and PHP code. PHP code are executed on the server, and the result is returned
to the browser as plain HTML. PHP files have extension “.php.
Signup Page
HomePage
Product Page
Variables
Variables are containers for storing data values.
Creating Variables
Python has no command for declaring a variable.
Example
x=5
y = "John"
print(x)
print(y)
Casting
If you want to specify the data type of a variable, this can be done with casting.
Global Variables
Variables that are created outside of a function (as in all of the examples in the previous
pages) are known as global variables.
Global variables can be used by everyone, both inside of functions and outside.
Example
x = "awesome"
def myfunc():
print("Python is " + x)
myfunc()
Variables can store data of different types, and different types can do different things.
Python has the following data types built-in by default, in these categories:
Example
x=5
print(type(x))
python
x = 10
y = -5
python
pi = 3.14
price = -99.99
python
z = 2 + 3j
d) bool (Boolean)
Only two values: True or False. Often used in conditions and loops.
Example:
python
is_active = True
is_logged_in = False
e) str (String)
python
name = " Yashwanth"
msg = 'Hello, World!'
b) tuple
python
coordinates = (10.0, 20.0)
c) range
python
nums = range(1, 6) # 1 to 5
python
student = {"name": "Yashwanth", "age": 21, "course": "BCA"}
python
colors = {"red", "blue", "green"}
b) frozenset
Dept of BCA, SHREE VEDHA COLLEGE Page | 12
Same as a set, but immutable (cannot be changed).
Example:
python
frozen = frozenset(["a", "b", "c"])
python
b = bytes([65, 66, 67])
b) bytearray
python
ba = bytearray([65, 66, 67])
ba[0] = 90
c) memoryview
python
mv = memoryview(bytes(5))
python
x=5
print(type(x))
# Output: <class 'int'>
Type Conversion:
python
Dept of BCA, SHREE VEDHA COLLEGE Page | 13
int("10")
# Converts string to intfloat("3.14")
# Converts string to floatstr(100)
# Converts int to stringlist("abc")
# Converts string to list
Python Loops
while loops
for loops
Example
i=1
while i < 6:
print(i)
i += 1
Python For Loops
A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a
set, or a string).
This is less like the for keyword in other programming languages, and works more like an
iterator method as found in other object-orientated programming languages.
With the for loop we can execute a set of statements, once for each item in a list, tuple, set
etc.
Example
Statement Description
Break Exits the loop prematurely.
continue Skips the current iteration and moves to the next.
pass Does nothing; acts as a placeholder.
Example of break:
python
for num in range(10):
if num == 5:
break
print(num)
Example of continue:
python
for num in range(5):
if num == 2:
continue
print(num)
Nested Loops
A loop inside another loop.
Example:
python
for i in range(3):
for j in range(2):
print(i, j)
Output:
00
01
10
Dept of BCA, SHREE VEDHA COLLEGE Page | 16
11
20
21
Summary Table
1. if Statement
The if statement is used to test a specific condition. If the condition evaluates to True, the
block of code under it runs.
python
x = 10if x > 5:
print("x is greater than 5")
2. if-else Statement
When the if condition is False, the code inside the else block will execute.
x=3
if x > 5:
3. if-elif-else Ladder
This allows checking multiple conditions one by one.
python
x=5
if x > 5:
print("x is greater than 5")
elif x == 5:
print("x is exactly 5")
else:
print("x is less than 5")
4. Nested if Statement
You can use one if statement inside another for more complex decision-making.
python
Python allows writing the if statement in a single line when it's a simple condition.
python
x = 10
if x > 5:
print("x is greater than 5")
python
x = 10
status = "High" if x > 5 else "Low"print(status)
python
num = int(input("Enter a number: "))
if num > 0:
print("The number is positive.")elif num == 0:
print("The number is zero.")else:
print("The number is negative.")
python
num = int(input("Enter a number: "))
if num % 2 == 0:
print("Even number.")else:
print("Odd number.")
python
username = input("Enter username: ")
password = input("Enter password: ")
if username == "admin" and password == "1234":
print("Login successful!")else:
print("Invalid credentials.")
Python Functions
A function in Python is a reusable block of code that performs a specific task.
Functions help to organize code, avoid repetition, and make programs modular and easier to
manage.
Predefined in Python.
User-Defined Functions
Creating a Function
Syntax:
python
def function_name(parameters):
# code block
return value
python
def greet():
print("Hello, Yashwanth!")
greet()
Output:
Hello, Yashwanth!
python
def greet(name):
print(f"Hello, {name}!")
greet("Yashwanth")
Output:
Dept of BCA, SHREE VEDHA COLLEGE Page | 20
Hello, Yashwanth!
python
def add(a, b):
return a + b
Output:
python
def greet(name="Guest"):
print(f"Hello, {name}!")
greet()
Variable-length Arguments
python
def sum_all(*numbers):
return sum(numbers)
print(sum_all(1, 2, 3, 4))
# Output: 10
Syntax:
python
lambda arguments: expression
Example:
python
square = lambda x: x * xprint(square(5)) # Output: 25
Python Modules
What is a Module?
Consider a module to be the same as a code library.
Create a Module
To create a module just save the code you want in a file with the file extension .py:
Example
Save this code in a file named mymodule.py
Dept of BCA, SHREE VEDHA COLLEGE Page | 22
def greeting(name):
print("Hello, " + name)
No installation needed.
Example:
import mathprint(math.sqrt(16))
# Output: 4.0
User-Defined Modules
Example:
python
# my_module.pydef greet(name):
return f"Hello, {name}!"
# main.pyimport my_moduleprint(my_module.greet("Yashwanth"))
bash
pip install numpy
Dept of BCA, SHREE VEDHA COLLEGE Page | 23
Reloading a Module
python
import importlibimport my_module
importlib.reload(my_module)
File Handling
The key function for working with files in Python is the open() function.
"r" - Read - Default value. Opens a file for reading, error if the file does not exist
"a" - Append - Opens a file for appending, creates the file if it does not exist
"w" - Write - Opens a file for writing, creates the file if it does not exist
"x" - Create - Creates the specified file, returns an error if the file exists
In addition you can specify if the file should be handled as binary or text mode
Syntax
To open a file for reading it is enough to specify the name of the file:
f = open("demofile.txt")
f = open("demofile.txt", "rt")
Because "r" for read, and "t" for text are the default values, you do not need to specify them
demofile.txt
The open() function returns a file object, which has a read() method for reading the content
of the file:
Example
f = open("demofile.txt")
print(f.read())
If the file is located in a different location, you will have to specify the file path, like this:
Example
f = open("D:\\myfiles\welcome.txt")
print(f.read())
Using the with statement
You can also use the with statement when opening a file:
Example
with open("demofile.txt") as f:
print(f.read())
Then you do not have to worry about closing your files, the with statement takes care of
that.
Close Files
It is a good practice to always close the file when you are done with it.
If you are not using the with statement, you must write a close statement in order to close
the file:
Dept of BCA, SHREE VEDHA COLLEGE Page | 26
Example
f = open("demofile.txt")
print(f.readline())
f.close()
Example
with open("demofile.txt") as f:
print(f.read(5))
Example
Open the file "demofile.txt" and append content to the file:
with open("demofile.txt", "a") as f:
f.write("Now the file has more content!")
"x" - Create - will create a file, returns an error if the file exists
"a" - Append - will create a file if the specified file does not exists
"w" - Write - will create a file if the specified file does not exists
Example
f = open("myfile.txt", "x")
Delete a File:
To delete a file, you must import the OS module, and run its os.remove() function:
Example
import os
os.remove("demofile.txt")
Example
import os
if os.path.exists("demofile.txt"):
os.remove("demofile.txt")
else:
print("The file does not exist")
Delete Folder:
To delete an entire folder, use the os.rmdir() method:
Example
import os
os.rmdir("myfolder")
python
class Student:
def __init__(self, name, age):
self.name = name
self.age = age
def display(self):
print(f"Name: {self.name}, Age: {self.age}")
# Creating an object
s1 = Student("Yashwanth", 20)
s1.display()
Dept of BCA, SHREE VEDHA COLLEGE Page | 29
Inheritance
Inheritance allows a class to acquire properties and methods from another class. It promotes
code reuse.
Single Inheritance
python
class Animal:
def speak(self):
print("Animal speaks")
class Dog(Animal):
def bark(self):
print("Dog barks")
d = Dog()
d.speak()
d.bark()
Multiple Inheritance
python
class Father:
def skill(self):
print("Gardening")
class Mother:
def skill(self):
print("Cooking")
class Child(Father, Mother):
def my_skill(self):
print("Painting")
c = Child()
c.skill() # Inherits from Father (priority from left)
c.my_skill()
Multilevel Inheritance
python
class Grandparent:
def house(self):
print("Big house")
class Parent(Grandparent):
def car(self):
print("SUV")
Dept of BCA, SHREE VEDHA COLLEGE Page | 30
class Child(Parent):
def bike(self):
print("Sports bike")
c = Child()
c.house()
c.car()
c.bike()
Type Description
Instance Method Operates on object using self
Class Method Uses @classmethod and cls
Uses @staticmethod, independent of
Static Method object python
class Demo:
def instance_method(self):
print("This is an instance method")
@classmethod
def class_method(cls):
print("This is a class method")
@staticmethod
def static_method():
print("This is a static method")
obj = Demo()
obj.instance_method()
Demo.class_method()
Demo.static_method()
Polymorphism
Polymorphism means “many forms”. In Python, it allows methods with the same name to
behave differently depending on the object or context.
Method Overriding:
python
class Bird:
def fly(self):
print("Birds can fly")
class Ostrich(Bird):
def fly(self):
Dept of BCA, SHREE VEDHA COLLEGE Page | 31
print("Ostrich can't fly")
b1 = Bird()
b2 = Ostrich()
b1.fly() # Birds can fly
b2.fly() # Ostrich can't fly
Encapsulation
Example:
python
class Account:
def __init__(self):
self.__balance = 0 # private variable
def get_balance(self):
return self.__balance
acc = Account()
acc.deposit(1000)print(acc.get_balance()) # 1000
Abstraction
Abstraction means hiding implementation details and showing only essential features.
This is achieved in Python using abstract classes and the abc module.
python
from abc import ABC, abstractmethod
class Vehicle(ABC): @abstractmethod
b = Bike()
b.start()
Constructor (__init__)
The constructor in Python is a special method: __init__().
It runs automatically when an object is created.
Example:
python
class Book:
def __init__(self, title):
self.title = title
b = Book("Python Guide")print(b.title)
Output:
nginx
Python Guide
Example:
python
class Demo:
def __del__(self):
print("Destructor called")
To create a login and registration system using Python and full-stack technologies, you can
use the following stack:
Create the style.css file inside the static folder (for styling purposes).
Visit http://127.0.0.1:5000/register to register and http://127.0.0.1:5000/login to log in.
This basic login and registration system uses SQLite to store user credentials. You can
expand on this by adding features like session management, email validation, password
reset, and more.
Note: Don’t worry about all the forks You’ll notice that there might be a few forks of
https://github.com/evildmp/afraid-to-commit;
So, which one is the real one- which one is the Django repository?
Contents Full Stack Development Documentation, Release 1.0 In a technical sense, they all
are, but the more useful answer is: the one that most people consider to be the canonical or
official version. In the case of Django, the version and above all, it’s the one that the
community treats as cannonical and official, not because it’s the original one, but because
it’s the most useful one to rally around. The same goes for https://github.com/evildmp/
afraid-to-commit and its more modest collection of forked copies. If I stop updating it, but
someone else is making useful updates to their own fork, then in time theirs might start to
become the one that people refer to and contribute to. This could even happen to Django
itself, though it’s not likely to any time soon. The proliferation of forks doesn’t somehow
dilute the original. Don’t be afraid to create more. Forks are simply the way collaboration is
made possible. Create a new branch Don’t edit the master (default) branch of the repository.
It’s much better to edit the file in a new branch, leaving the master branch clean and
untouched:
1. select the branch menu
2. in Find or create a branch... enter add-my-name
3. hit Create branch: add-my-name
Note: Don’t hesitate to branch As you may have noticed on GitHub, a repository can have
numerous branches within it. Branches are ways of organising work on a project: you can
have a branch for a new feature, for trying out something new, for exploring an issue-
anything at all. Just as virtualenvs are disposable, so are branches in Git. You can have too
many branches, but don’t hesitate to create new ones; it costs almost nothing. It’s a good
policy to create a new branch for every new bit of work you start doing, even if it’s a very
small one. It’s especially useful to create a new branch for every new feature you start work
on. Branch early and branch often. If you’re in any doubt, create a new branch. Edit a file
GitHub allows you to edit files online. This isn’t the way you will normally use Git, and it’s
1. go to https://github.com//afraid-to-commit
2. find the attendees_and_learners.rst file
3. hit the Edit button
4. add your name (just your name, you will add other information later) to the appropriate
place in the file. If you’re following the tutorial by yourself, add your details in the I
followed the tutorial online section. 1.3. Phase II: Team Project Workflow 25 Full Stack
Development Documentation, Release 1.0 Commit your changes
• hit Commit Changes Nowyour copy of the file, the one that belongs to your fork of the
project, has been changed; it’s reflected right away on GitHub. If you managed to mis-spell
your name, or want to correct what you entered, you can simply edit it again. What you
have done now is make some changes, in a new branch, in your own fork of the repository.
You can see them there in the file. Make a Pull Request When you’re ready to have your
changes incorporated into my original/official/canonical repository, you do this by making
a Pull Request.
• go back to https://github.com//
afraid-to-commit You’ll see that GitHub has noted your recent changes, and now offers
various buttons to allow you to compare them with the original or make a pull request.
• hit Compare & pull request This will show you a compare view, from which you can
make your pull request. When preparing for a pull request, GitHub will show you what’s
being compared: evildmp:master ... :add-my-name On the left is the base for the
comparison, my fork and branch. On the right is the head, your fork and branch, that you
want to compare with it. Apull request goes from the head to the base- from right to left.
You can change the bases of the comparison if you need to:
1. hit Edit
Introduction to HTML
What is HTML?
HTML is not a programming language; it is a markup language that defines the structure
and layout of a web document by using a system of tags and attributes. It tells the web
browser how to display content like text, images, links, videos, and more.
Features of HTML
Multimedia Support: Embeds images, audio, and video content directly into web pages.
html
<!DOCTYPE html><html><head>
<title>Page Title</title></head><body>
<h1>This is a Heading</h1>
<p>This is a paragraph of text.</p></body></html>
Tag Description
<h1> to <h6> Headings from largest to smallest
<p> Paragraph of text
<a> Anchor tag for hyperlinks
<img> Embeds images
<div> Container for block elements
<span> Container for inline elements
<table> Creates tables
<form> Creates user input forms
<ul>, <ol>, <li> Lists (unordered/ordered)
Dept of BCA, SHREE VEDHA COLLEGE Page | 41
Importance of HTML in Full Stack Development
As a Full Stack Developer:
HTML is essential for rendering dynamic content and creating responsive designs.
It is integrated with back-end frameworks (like Flask, Django) through templating engines
such as Jinja2.
Evolution of HTML
HTML 1.0 (1993): The first release with basic tags.
HTML 4.01 (1999): Added support for scripting languages like JavaScript.
HTML5 (2014): Modern version with features like audio, video, and local storage without
needing plugins.
Advantages of HTML
Free and Open Standard: No licensing required; it's open for everyone.
SEO Friendly: HTML structures like headings, paragraphs, and meta tags improve Search
Engine Optimization (SEO).
Cross-Platform Support: HTML works uniformly across various operating systems and
browsers.
Integration with Other Languages: HTML can easily integrate with CSS, JavaScript, and
server-side languages like Python (using Django, Flask)
Applications of HTML
1. Website Development: Every website uses HTML at its core.
2. Web Application Frontends: Web apps like Gmail, Facebook, and Twitter use HTML
in their user interfaces.
3. Email Templates: HTML is used to design professional, responsive email layouts.
Dept of BCA, SHREE VEDHA COLLEGE Page | 42
4. Mobile App Development: Tools like React Native or Flutter web components use
HTML-like syntax.
5. Game Development: Some simple browser games use HTML5 Canvas element.
Local Storage and Session Storage: Storing data on the client side.
Responsive Web Design: Combined with CSS3 for better mobile compatibility.
Back-End Integration: Frameworks like Django and Flask use HTML through templating
engines such as:
Dynamic Pages: Python renders dynamic HTML based on user interaction and database
queries.
Real-Life Example
Progressive Web Apps (PWA): New-age apps combining web and mobile app features.
Web Assembly Integration: Future will see HTML working alongside high-performance
Web Assembly modules.
Virtual and Augmented Reality: With WebXR APIs, HTML is stepping into VR and AR
applications.
<h2>My Hobbies</h2>
<ul>
<li>Learning Web Development</li>
<li>Exploring AI and Machine Learning</li>
<li>Reading Technology Blogs</li>
</ul>
<h2>Skills</h2>
<table border="1" cellpadding="10">
<tr>
<th>Skill</th>
<th>Level</th>
</tr>
<tr>
<td>HTML</td>
<td>Intermediate</td>
</tr>
<tr>
Dept of BCA, SHREE VEDHA COLLEGE Page | 44
<td>Python</td>
<td>Intermediate</td>
</tr>
<tr>
<td>JavaScript</td>
<td>Beginner</td>
</tr>
</table>
<h2>My Picture</h2>
<img src="https://via.placeholder.com/150" alt="My Profile Picture" width="150"
height="150">
Structure in HTML
Structure in HTML means how different sections of a webpage are arranged logically and
visually.
The structure is built using structural tags to organize the content.
<html>
<head>
<title>My Website</title>
</head>
<body>
<header>Site Header</header>
<nav>Navigation Links</nav>
<section>Main Content</section>
<aside>Sidebar</aside>
<footer>Footer Information</footer>
</body></html>
Tags in HTML
Types of Tags:
Example:
html
<p>This is a paragraph.</p><a href="https://example.com">This is a link</a><img
src="photo.jpg" alt="A photo">
Form in HTML
Forms are used to collect information from users, like login details, feedback, or orders.
Tag Purpose
<form> Defines a form for user input.
<input> Single-line input field (text, password, email, etc.).
<textarea> Multi-line text input.
<select> Drop-down list.
<option> Items inside a <select>.
<button> Button to submit or reset the form.
<label> Label for an input field (improves accessibility).
Table in HTML
Tag Purpose
<table> Creates the table.
<tr> Creates a table row.
<td> Creates a table data/cell.
<th> Creates a header cell (bold and centered).
<thead> Groups header rows.
<tbody> Groups body rows.
<tfoot> Groups footer rows.
<table border="1">
<thead>
<tr>
<th>Name</th>
<th>Age</th>
</tr>
</thead>
<tbody>
<tr>
<td>Yashwanth </td>
<td>20</td>
</tr>
<tr>
<td>Rahul</td>
<td>21</td>
</tr>
</tbody></table>
<!DOCTYPE html>
<html>
<head>
<title>My First Webpage</title></head><body>
<h1>Welcome to My Website</h1>
<p>This is a paragraph of text on my first webpage.
</p>
Dept of BCA, SHREE VEDHA COLLEGE Page | 48
</body>
</html>
OUTPUT
HTML Code:
<!DOCTYPE html>
<html>
<head>
<title>Text Formatting Example</title>
</head>
<body>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<p><strong>Bold Text</strong> and <em>Italic Text</em>.
</p>
<p>This is a <u>underlined</u> text example.
</p>
</body>
</html>
OUTPUT
HTML Code:
<!DOCTYPE html><html><head>
OUTPUT
HTML Code:
<!DOCTYPE html><html><head>
<title>Simple Table</title></head><body>
<h1>Student Information</h1>
<table border="1">
<tr>
<th>Name</th>
<th>Roll No</th>
<th>Course</th>
</tr>
<tr>
Dept of BCA, SHREE VEDHA COLLEGE Page | 50
<td>Ram</td>
<td>101</td>
<td>BCA</td>
</tr>
<tr>
<td>Seetha</td>
<td>102</td>
<td>BCA</td>
</tr>
</table></body></html>
OUTPUT
Introduction to CSS
What is CSS?
CSS (Cascading Style Sheets) is a style sheet language that describes the presentation of a
web page written in HTML or XML. CSS controls the layout of multiple web pages at once,
making it easier to maintain and update the design of a website without changing the
HTML content.
In full-stack web development, CSS is crucial for creating the user interface (UI) and
enhancing the user experience (UX). It controls how the website looks, how elements are
arranged, and how responsive the site is on different devices.
Property: Defines the aspect of the HTML element you want to change (e.g., color, font
size).
Value: Specifies the value for the property (e.g., blue, 16px).
Example:
css
h1 {
color: blue;
font-size: 24px;
text-align: center;
}
In Flask, static files such as CSS are typically stored in the static directory. You can link to
CSS files in your HTML templates using Flask's url_for() function, which generates the
correct URL to the static file.
Folder Structure
CSS in Django
Django uses a similar structure to Flask but requires additional setup for static files in the
settings.py file. You need to include 'django.contrib.staticfiles' in your INSTALLED_APPS.
All elements in CSS are rectangular boxes, and their layout is controlled through the box
model. The box model consists of four components:
Margin: Space outside the border, separating the element from others
css
div {
width: 200px;
padding: 20px;
border: 5px solid black;
margin: 10px;
}
Flexbox Layout
Flexbox is a one-dimensional layout model that helps distribute space along a row or
column.
Example:
css
.container {
display: flex;
justify-content: space-between;
}
Grid Layout
CSS Grid Layout provides a two-dimensional grid-based layout system that works both
horizontally and vertically.
Example:
css
.container {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-gap: 10px;
}
Responsive Design
Media Queries
Media queries allow you to apply different styles for different screen sizes. They help
create responsive designs that adjust based on the device’s screen width.
css
@media screen and (max-width: 600px) {
body {
background-color: lightblue;
}
}
CSS preprocessors like Sass and LESS enhance CSS by adding features such as variables,
nesting, and mixins. These features make your CSS more maintainable, modular, and easier
to manage.
Sass Example:
scss
$primary-color: #3498db;$font-size: 16px;
body {
background-color: $primary-color;
font-size: $font-size;
}
Bootstrap
Example:
html
<button class="btn btn-primary">Click Me</button>
Tailwind CSS
Tailwind is a utility-first CSS framework that allows you to apply styles directly in HTML
using utility classes.
To improve maintainability, CSS should be modular. This means breaking your CSS into
smaller, reusable components or files.
BEM is a naming convention for CSS classes to make the code more readable and
maintainable.
Example:
css
.button { }.button__icon { }.button--primary { }
Use external stylesheets rather than inline styles to separate content and design, which
improves performance and maintainability.
You can use browser developer tools like Chrome DevTools to inspect and modify CSS on
the fly.
Example:
You can see the styles applied to the element and modify them live.
Inline CSS
Dept of BCA, SHREE VEDHA COLLEGE Page | 56
➤ Description:
CSS is written directly in the HTML element using the style attribute. This affects only that
specific element.
➤ Syntax Example:
➤ Use Case:
➤ Pros:
➤ Cons:
Hard to maintain.
Internal CSS
➤ Description:
CSS rules are defined inside a <style> tag within the <head> section of the HTML file.
➤ Syntax Example:
<!DOCTYPE html><html><head>
<style>
h1 {
color: green;
font-family: Arial;
}
</style></head><body>
<h1>Hello World</h1></body></html>
➤ Pros:
➤ Cons:
External CSS
➤ Description:
CSS rules are written in a separate .css file and linked to the HTML file using a <link> tag.
➤ Syntax Example:
HTML File:
<!DOCTYPE html><html><head>
<link rel="stylesheet" href="styles.css"></head><body>
<h1>External CSS Example</h1></body></html>
styles.css File:
h1 {
color: red;
text-align: center;
}
➤ Use Case:
Ideal for large-scale applications and when reusing styles across multiple pages.
➤ Pros:
➤ Cons:
Example:
Django Example:
The background-color property in CSS is used to define the background color of HTML
elements. This property is fundamental in front-end web development and plays a crucial
role in enhancing user interface aesthetics and improving the user experience by visually
differentiating sections or elements.
Syntax:
css
selector {
background-color: value;
}
css
.container {
background-color: #e0f7fa;
}
The border property is used to apply a boundary around an HTML element. It helps in
visually separating content, enclosing input fields, and creating structured layouts.
Shorthand Syntax:
selector {
border: [width] [style] [color];
}
.card {
border: 2px solid #009688;
border-radius: 10px; /* for rounded corners */
}
html
<div class="profile-box">
Welcome, User!</div>
CSS:
css
.profile-box {
background-color: #fef3c7;
border: 3px dashed #f59e0b;
padding: 20px;
width: 300px;
}
This style was used to highlight user profile boxes on a dashboard developed during the
internship.
The background-color property in CSS is used to define the background color of HTML
elements. This property is fundamental in front-end web development and plays a crucial
Syntax:
selector {
background-color: value;
}
.container {
background-color: #e0f7fa;
}
This can be used in an external stylesheet and linked to an HTML template in a Django
application for styling div or section elements.
selector {
border: [width] [style] [color];
}
Example:
.card {
border: 2px solid #009688;
border-radius: 10px; /* for rounded corners */
}
<div class="profile-box">
Welcome, User!</div>
CSS:
.profile-box {
background-color: #fef3c7;
border: 3px dashed #f59e0b;
Dept of BCA, SHREE VEDHA COLLEGE Page | 63
padding: 20px;
width: 300px;
}
This style was used to highlight user profile boxes on a dashboard developed during the
internship.
Definition:
The background-color property in CSS sets the background color of an element. It affects
the entire area of the element, including its padding and border, but not the margin.
Syntax:
css
selector {
background-color: value;
}
value: Can be a color name (red), HEX code (#ff0000), RGB (rgb(255, 0, 0)), RGBA
(rgba(255, 0, 0, 0.5)), HSL (hsl(0, 100%, 50%)), or HSLA (hsla(0, 100%, 50%, 0.5)).
Border Property
Definition:
The border property is a shorthand in CSS that sets the width, style, and color of an
element's border. It can be used to define borders on all sides of an element simultaneously.
selector {
border: [border-width] [border-style] [border-color];
}
border-style: Defines the style of the border (solid, dashed, dotted, double, groove, ridge,
inset, outset, none).
A web framework is a software tool that provides a structured and reusable way to build
and deploy web applications. In Python, the two most popular web frameworks are Flask
and Django. Both help in handling backend functionalities like URL routing, request
handling, database operations, and rendering HTML templates.
Flask Framework
Definition:
Key Features:
Syntax Example:
app = Flask(__name__)
@app.route("/")def home():
return "Welcome to Flask"
if __name__ == "__main__":
app.run(debug=True)
Django Framework
Definition:
Django is a high-level Python web framework that promotes rapid development and clean,
pragmatic design. It follows the "batteries-included" philosophy, meaning it comes with a
wide range of features built-in, such as authentication, ORM (Object Relational Mapper),
admin panel, and more.
Key Features:
Syntax Example:
python
# views.pyfrom django.http import HttpResponse
def home(request):
return HttpResponse("Welcome to Django")
python
\# urls.pyfrom django.urls import pathfrom . import views
urlpatterns = [
path('', views.home, name='home'),
]
To Set Up:
Dynamic content refers to parts of a webpage that are generated on the server side using
data, instead of being hard-coded. In full stack development, this content is inserted into
HTML using template engines like Jinja2 (Flask) or Django Templates, based on values
passed from the backend.
Flask Setup:
Example:
OUTPUT
HTML files are stored in the templates/ folder inside your app.
Example:
templates/index.html:
Flask uses HTML forms, and form data is accessed using request.form. For validation,
developers commonly use Flask-WTF (WTForms extension).
app.py
Django provides built-in support for form handling via forms.py, with automatic validation
and error rendering. Basic Example
forms.py
templates/login.html
Deployment is the process of making a web application live on the internet so users can
access it through a browser. After developing a project locally using Flask or Django, it
needs to be hosted on a cloud platform or web server for public access.
Example: Procfile
requirements.txt
bash
Flask==2.2.2
gunicorn==20.1.0
Folder Structure
Select:
Add requirements.txt
Add Procfile
Procfile
requirements.txt (sample)
bash
Django==4.0.0
gunicorn==20.1.0
Go to PythonAnywhere Website:
Sign Up:
Choose a Plan:
PythonAnywhere offers different plans (Free, Hacker, and Web Developer). Select the Free
Plan if you want to use it for small projects. You can upgrade later if needed.
The Free plan gives you access to a single web app and limited resources.
Complete Captcha:
PythonAnywhere may ask you to complete a CAPTCHA to verify you're not a robot.
Open your inbox and click the verification link to confirm your email.
Login to PythonAnywhere:
After email verification, you can log in to PythonAnywhere with the credentials you
created.
After logging in, navigate to the "Web" tab in the top menu.
You can upload your Python files (e.g., app.py for Flask or manage.py for Django) and
static files through the Files section.
In the Web tab, you can configure your app’s settings, including:
Static Files & Media: Set up static file and media directories.
After setting it up, you can start the web app, and PythonAnywhere will assign you a
subdomain (e.g., yourusername.pythonanywhere.com).
If you already have a GitHub account, click on Sign in in the top right corner and enter
your credentials.
2. Go to Your Profile:
After logging in, click on your profile icon in the top right corner and select Your
repositories.
Repository Name: Choose a name for your repository (e.g., my-flask-project or my-
django-app).
Description (Optional): Add a short description of your project (e.g., "A simple Flask web
app").
Private: Only you and people you specify can see the repository.
Initialize with README: Check this box if you want to add a README file to the
repository automatically (which is usually recommended for documentation).
bash
cd my-project-folder
git init
bash
git add .
bash
git commit -m "Initial commit"
Get the remote repository URL from GitHub. It will look something like this:
perl
https://github.com/yourusername/my-flask-project.git
bash
git remote add origin https://github.com/yourusername/my-flask-project.git
bash
git push -u origin master
bash
git push
Get the Repository URL: Once the repository is created, you’ll need the URL of the
repository. Here’s how to get it:
On the top right of the page, you’ll see a Code button (green).
Click on it, and you will see the URL in either HTTPS or SSH format.
HTTPS URL:
scss
[email protected]:username/repository-name.git
Example:
If your GitHub username is Yashwanth and the repository name is my-flask-project, the
repository URL would be:
perl
https://github.com/Yashwanth/my-flask-project.git
Once you have the URL, you can link your local project to the GitHub repository by
running the following command in your project folder:
bash
git remote add origin https://github.com/username/repository-name.git
bash
git push -u origin master
A .gitignore file is used to tell Git which files or directories it should ignore when you
commit code. It’s essential for preventing sensitive files, build files, or system-specific files
(like IDE configurations) from being tracked in your Git repository.
You can create it using a text editor or via the terminal with this command:
bash
touch .gitignore
Open the .gitignore file in your preferred text editor (e.g., VS Code, Sublime, Notepad++)
and add the files and folders you want Git to ignore.
__pycache__/
*.py[cod]
# Virtual Environment
venv/
.env/
# IDE files
.vscode/
.idea/
.DS_Store
Thumbs.db
# Logs
# Databases
*.sqlite3
*.db
*.whl
# Distribution directories
build/
dist/
bash
Commit the .gitignore File: After adding .gitignore, commit it to your Git repository:
bash
git commit -m "Add .gitignore file”
Push to GitHub: Finally, push your changes (including the .gitignore file) to GitHub:
Bash
git push
After logging in, go to the "Web" tab at the top of the page.
Dept of BCA, SHREE VEDHA COLLEGE Page | 84
If you already have a web app set up, click on it to open its settings.
If not, click "Add a new web app" to create a new one and choose your web framework
(Flask, Django, etc.).
Start a new Bash console by clicking "Bash" under the Consoles section.
Once the Bash console is open, use the following command to create a virtual environment:
bash
python3 -m venv /home/yourusername/.virtualenvs/myen
Replace myenv with the desired name for your virtual environment.
After creating the virtual environment, you need to activate it. Run the following command:
bash
source /home/yourusername/.virtualenvs/myenv/bin/activate
5. Install Dependencies:
Once the virtual environment is activated, you can install the required dependencies for
your project (e.g., Flask, Django, etc.). Use the following command to install packages:
bash
pip install -r /path/to/your/project/requirements.txt
bash
pip install flask # or any other dependency
Under the "Virtualenv" section, you’ll see a field for Virtualenv. Here, enter the path to
the virtual environment you created earlier:
swift
/home/yourusername/.virtualenvs/myenv
If your web app uses static files (images, CSS, JavaScript), make sure to configure the
static files and media files sections in the "Web" tab. You can specify the directory path
for static files and media files.
After configuring the environment and setting up the dependencies, go back to the "Web"
tab.
Click "Reload" to restart your web app with the new virtual environment and settings.
Ensure that the app is working correctly, and the environment has been set up properly.
First, log in to your PythonAnywhere account and open a Bash console from the
"Consoles" tab.
Create a Folder
bash
mkdir myprojectcd myproject
bash
Dept of BCA, SHREE VEDHA COLLEGE Page | 86
git clone https://github.com/yourusername/your-repo-name.gitcd your-repo-name
You should always create a virtual environment to isolate dependencies for your project.
bash
python3 -m venv ~/.virtualenvs/myenv
Here:
bash
source ~/.virtualenvs/myenv/bin/activate
When it's activated, your terminal prompt will show the virtual environment name in
parentheses like:
ruby
(myenv) yourusername@pythonanywhere:~/myproject/your-repo-name$
bash
pip install -r requirements.txt
bash
pip install flask
pip install django
pip install gunicorn
Swift
/home/yourusername/.virtualenvs/myenv
txt
Django==4.2.6
gunicorn==21.2.0
txt
psycopg2-binary==2.9.9
dj-database-url==2.1.0
python-decouple==3.8
How to Use
bash
pip install -r requirements.txt
This will automatically install all required packages into your virtual environment.
Log in to https://www.pythonanywhere.com
3. Choose Framework
Select:
Choose the correct Python version (the one you used in your virtual environment)
swift
/home/yourusername/myproject/your-repo-name
Under the "WSGI configuration file" section, click the path shown to open the .py config
file.
For Django:
Change:
python
CopyEdit
os.environ['DJANGO_SETTINGS_MODULE'] = 'yourproject.settings'
swift
/home/yourusername/.virtualenvs/myenv
Scroll to the top or bottom and click "Reload" to apply all changes.
arduino
CopyEdit
https://yourusername.pythonanywhere.com
bash
bash
bash
Before running this command, make sure your settings.py has the correct STATIC_ROOT,
like:
Then run:
Bash
It will collect all static files into the STATIC_ROOT directory (like CSS, JS, images).
URL: /static/
Directory: /home/yourusername/yourprojectfolder/staticfiles
When you:
Go to: https://www.pythonanywhere.com
After logging in, click the "Web" tab at the top of the dashboard.
Once clicked:
It re-applies the latest settings, code, static files, and database migrations.
Sample View:
After Reloading
Go to:
Check:
Books
1. Object Oriented Programming Using JAVA - Srikanth.S
1. https://www.w3schools.com/python/
2. https://flask.palletsprojects.com/
3. https://docs.djangoproject.com/
4.https://developer.mozilla.org/en-US/docs/Web
5.https://www.w3schools.com/html/
6.https://www.w3schools.com/css/
7. https://www.w3schools.com/js/