Search This Blog

Subscribe to this blog

Follow by Email

Beginners Guide For Django(Web Framework)

Django is a free and open-source web framework, written in Python, which follows the model-view-template (MVT) architectural pattern. It is maintained by the Django Software Foundation (DSF). Django's primary goal is to ease the creation of complex, database-driven websites. Django emphasizes reusability and "pluggability" of components, rapid development, and the principle of Don't Repeat Yourself(DRY). Django is available under the ​BSD license. The source code repository is stored on ​GitHub.

Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. It’s free and open source. Django was designed to help developers take applications from concept to completion as quickly as possible. Django takes security seriously and helps developers avoid many common security mistakes. Some of the busiest sites on the Web leverage Django’s ability to quickly and flexibly scale.

Creating First Project in Django
1. Create a directory where you will keep all of your Django Projects.
2. cd to that directory and type > django-admin startproject MySite (here MySite is project name). MySite directory is just a container for your project.
Now. your directory structure will be like
MySite/
manage.py
MySite/
__init__.py
settings.py
urls.py
wsgi.py
3. Now Start an app inside the project directory by typing > python manage.py startapp myapp(this command will create the directory of the app with name myapp)
Directory structure for myapp will be like
myapp/
__init__.py
admin.py
apps.py
migrations/
__init__.py
models.py
tests.py
views.py
__init__.py file tells Python that this directory is be considered as a Python package. This is an empty file.
4. To see something on the web browser open up the views.py file in any code editor(i will suggest you PyCharm) and write the below code in it.

from django.http import HttpResponse
def index(request):
return HttpResponse("Hello, Welcome to Django. You created your first app successfully, congratulations to you.")

5. Now open up the urls.py file in MySite directory and write the below code in it.

6. Now to run the server type > python manage.py runserver(this command will start the server and gives you the url of your app like "Starting development server at http://127.0.0.1:8000/") click on the url and you will see your apps first page.

Note: after running python manage.py runserver you might get something on terminal which will say the you have few unapplied migration(s). Your project may not work properly until you apply the migrations for app(s). Run 'python manage.py migrate' to apply them. So ignore that for now you can learn that later when you will write some advanced apps for projects. Because it is related to all database creation and tables creation.

7. You can also runserver on different ip and port by typing
python manage.py runserver 0.0.0.0:8888 OR python manage.py runserver 8080

Here i have an app, you can see it. This app has the task of uploading and downloading files, and saving the data into MySQL database.

Comments

Post a Comment

Popular posts from this blog

Older versions of Android can be remotely reset by Google if the company is issued with a court order, but only if they're locked using a pattern.

This is according to a document prepared by the New York District Attorney's Office which revealed just how easily investigators could see the contents of a device.

Devices running Android 5.0 and newer cannot be remotely reset as they use full disk encryption.
However, this option is not switched on by default.

The report found any device using an older version of the operating system is vulnerable to remote reset and according to the Android Developer Dashboard, this is 74.1 per cent of Android devices currently being used.
However, this figure is slightly misleading.

The remote reset feature does apply to phones running operating systems before Android L, but it only applies to people how have secured their device with a pattern.

Google can't remotely reset phones secured with a PIN or passcode, meaning the number of af…

Ethical Hacking, also known as penetration testing, intrusion testing, or red teaming, is the controversial act of locating weaknesses and vulnerabilities of computer and information systems by duplicating the intent and actions of malicious hackers.

An Ethical Hacker, also known as a whitehat hacker, or simply a whitehat, is a security professional who applies their hacking skills for defensive purposes on behalf of the owners of information systems. Nowadays, certiﬁed ethical hackers are among the most sought after information security employees in large organizations such as Wipro, Infosys, IBM, Airtel and Reliance among others.

Definition:
Ethical hacking refers to the act of locating weaknesses and vulnerabilities of computer and information systems by duplicating the intent and actions of malicious hackers. Ethical hacking is also known as penetration testing, intrusion testing, or red teaming. An ethical hacker is a security professional who applies their hacking skills for d…

WinHex as a disk editing program and has developed into a forensic tools that is useful to digital evidence examiners of all skill levels.WinHex is a universal hex editor, particularly helpful in the realm of computer forensics, data recovery, low-level data editing. With WinHex you can view and hex edit the following: any kind of file, in particular binary fileshard disksfloppy disksCD-ROM & DVD (read-only)smart media, compact flash, memory sticksall other drive types accessible in Windowseven your computer's RAM!
Its An advanced tool for everyday and emergency use: inspect and edit all kinds of files, recover deleted files or lost data from hard drives with corrupt file systems or from digital camera cards.
The disk editor specially supports the following file systems: FAT12, FAT16, FAT32, NTFS. Useful to inspect and edit all kinds of files, recover deleted files or lost data from hard drives with corrupt file systems or from digital camera cards. This hex editor opens files …

In this post you will learn how to decompile an apk file and understand its code and add some of your code to that apk. In this post i am sharing a link of youtube playlist which will demonstrate how to decompile a Twitter apk and understand its code, to inject our own code and get the username and password of the user.
For this you will require Apktool jar, Procyon decompiler. After downloading it follow below steps
1. Download Linux wrapper.
2. Rename downloaded jar to apktool.jar
5. Move both files (apktool.jar & apktool wrapper) to /usr/local/bin (root needed)
6. Make sure both files are executable (chmod +x)

PostgreSQL, often simply Postgres, is an object-relational database (ORDBMS) – i.e. a RDBMS, with additional (optional use) "object" features – with an emphasis on extensibility and standards compliance. As a database server, its primary function is to store data securely, and to allow for retrieval at the request of other software applications. It can handle workloads ranging from small single-machine applications to large Internet-facing applications (or for data warehousing) with many concurrent users; on macOS, PostgreSQL is the default database – for web hosting – and it is also available for Microsoft Windows and Linux (supplied in most distributions).
PostgreSQL is ACID-compliant and transactional. PostgreSQL has updatable views and materialized views, triggers, foreign keys; supports functions and stored procedures, and other expandability.
PostgreSQL is developed by the PostgreSQL Global Development Group, a diverse group of many companies and individual contribut…