Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7698589

Browse files
Merge pull request avinashkranjan#380 from pritamp17/issue_351
Distance calculating app.
2 parents 2493e7f + 648bd70 commit 7698589

37 files changed

+502
-0
lines changed

‎Calculate-distance/.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// geoIP with GeoLite2-City and GeoLite2-Country
2+
geoip/

‎Calculate-distance/Readme.md‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Distance Calculating Django App
2+
App that can show distance between user's location and searched location on map.
3+
4+
# Packages Used
5+
1. Geopy
6+
2. folium
7+
3. crispy-form
8+
4. Bootstrap
9+
10+
# How to run
11+
**1.** Fork [this](https://github.com/avinashkranjan/Amazing-Python-Scripts.git) repository.
12+
13+
**2.** Clone your forked copy of the project.
14+
15+
```
16+
git clone https://github.com/<your_user_name>/Amazing-Python-Scripts.git
17+
```
18+
Navigate to the project directory.
19+
```bash
20+
cd Amazing-Python-Scripts/Calculate-distance
21+
```
22+
```
23+
create folder named 'geoip' in main project directory.
24+
```
25+
```
26+
download city and country database
27+
```
28+
[For downloading city and country database ](https://www.maxmind.com/en/accounts/497315/people/84e6213c-91a4-4e02-ae2e-1d709084c544)
29+
1. ![](https://github.com/pritamp17/Calculate-Distance/blob/main/1.paste.png)
30+
2. ![](https://github.com/pritamp17/Calculate-Distance/blob/main/2.paste.png)
31+
32+
```
33+
extract the zip files and copy paste
34+
1. GeoLite2-City.mmdb
35+
2. GeoLite2-country.mmdb
36+
to geoip folder
37+
```
38+
```bash
39+
pip install -r requirements.txt
40+
```
41+
```bash
42+
python manage.py runserver
43+
```
44+
# And here you go
45+
![](https://github.com/pritamp17/Calculate-Distance/blob/main/django-1-test2.png)
46+
![](https://github.com/pritamp17/Calculate-Distance/blob/main/django-2-test2.png)
47+
![](https://github.com/pritamp17/Calculate-Distance/blob/main/django-3-test2.png)
48+
49+
# Author
50+
[Pritam Pawar](https://github.com/pritamp17)

‎Calculate-distance/db.sqlite3‎

140 KB
Binary file not shown.

‎Calculate-distance/distance_proj/__init__.py‎

Whitespace-only changes.
180 Bytes
Binary file not shown.
2.47 KB
Binary file not shown.
1.02 KB
Binary file not shown.
595 Bytes
Binary file not shown.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
ASGI config for distance_proj project.
3+
4+
It exposes the ASGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.asgi import get_asgi_application
13+
14+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'distance_proj.settings')
15+
16+
application = get_asgi_application()
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
"""
2+
Django settings for distance_proj project.
3+
4+
Generated by 'django-admin startproject' using Django 3.1.4.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/3.1/topics/settings/
8+
9+
For the full list of settings and their values, see
10+
https://docs.djangoproject.com/en/3.1/ref/settings/
11+
"""
12+
13+
from pathlib import Path
14+
import os
15+
16+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
17+
BASE_DIR = Path(__file__).resolve().parent.parent
18+
19+
20+
# Quick-start development settings - unsuitable for production
21+
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
22+
23+
# SECURITY WARNING: keep the secret key used in production secret!
24+
SECRET_KEY = 'ns4ev24u@efvcuii*7g1=e)_((y6b2b(%wh(__7d#2y5n3e%t4'
25+
26+
# SECURITY WARNING: don't run with debug turned on in production!
27+
DEBUG = True
28+
29+
ALLOWED_HOSTS = []
30+
31+
32+
# Application definition
33+
34+
INSTALLED_APPS = [
35+
'django.contrib.admin',
36+
'django.contrib.auth',
37+
'django.contrib.contenttypes',
38+
'django.contrib.sessions',
39+
'django.contrib.messages',
40+
'django.contrib.staticfiles',
41+
'measurements',
42+
'crispy_forms',
43+
]
44+
45+
MIDDLEWARE = [
46+
'django.middleware.security.SecurityMiddleware',
47+
'django.contrib.sessions.middleware.SessionMiddleware',
48+
'django.middleware.common.CommonMiddleware',
49+
'django.middleware.csrf.CsrfViewMiddleware',
50+
'django.contrib.auth.middleware.AuthenticationMiddleware',
51+
'django.contrib.messages.middleware.MessageMiddleware',
52+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
53+
]
54+
55+
ROOT_URLCONF = 'distance_proj.urls'
56+
57+
TEMPLATES = [
58+
{
59+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
60+
'DIRS': [os.path.join(BASE_DIR, 'templates')],
61+
'APP_DIRS': True,
62+
'OPTIONS': {
63+
'context_processors': [
64+
'django.template.context_processors.debug',
65+
'django.template.context_processors.request',
66+
'django.contrib.auth.context_processors.auth',
67+
'django.contrib.messages.context_processors.messages',
68+
],
69+
},
70+
},
71+
]
72+
73+
WSGI_APPLICATION = 'distance_proj.wsgi.application'
74+
75+
76+
# Database
77+
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
78+
79+
DATABASES = {
80+
'default': {
81+
'ENGINE': 'django.db.backends.sqlite3',
82+
'NAME': BASE_DIR / 'db.sqlite3',
83+
}
84+
}
85+
86+
87+
# Password validation
88+
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
89+
90+
AUTH_PASSWORD_VALIDATORS = [
91+
{
92+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
93+
},
94+
{
95+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
96+
},
97+
{
98+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
99+
},
100+
{
101+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
102+
},
103+
]
104+
105+
CRISPY_ALLOWED_TEMPLATE_PACKS = ('bootstrap', 'uni_form', 'bootstrap3', 'foundation-5')
106+
# CRISPY_TEMPLATE_PACK='bootstap4'
107+
108+
# Internationalization
109+
# https://docs.djangoproject.com/en/3.1/topics/i18n/
110+
111+
LANGUAGE_CODE = 'en-us'
112+
113+
TIME_ZONE = 'UTC'
114+
115+
USE_I18N = True
116+
117+
USE_L10N = True
118+
119+
USE_TZ = True
120+
121+
GEOIP_PATH = os.path.join(BASE_DIR,'geoip')
122+
# Static files (CSS, JavaScript, Images)
123+
# https://docs.djangoproject.com/en/3.1/howto/static-files/
124+
125+
STATIC_URL = '/static/'

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /