Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7af03c3
Initial commit
BharathKumarRavichandran Jan 19, 2019
fd8ef8e
Add api.urls
BharathKumarRavichandran Jan 19, 2019
e033888
Added redirecting urls
lharinarayanan Jan 19, 2019
f223c80
Add api models
BharathKumarRavichandran Jan 19, 2019
688861f
Add api fixtures
BharathKumarRavichandran Jan 19, 2019
97f5b09
Add api migration files
BharathKumarRavichandran Jan 19, 2019
63d7648
Update api.urls
BharathKumarRavichandran Jan 19, 2019
659eeb5
Modify api urls
BharathKumarRavichandran Jan 19, 2019
f996eef
Comment out CSRF middleware
BharathKumarRavichandran Jan 19, 2019
d88a1ad
Fix: Fix pk of Place fixtures
BharathKumarRavichandran Jan 19, 2019
ed13ce4
Update api migrations
BharathKumarRavichandran Jan 19, 2019
184ea3e
Remove views directory from api
BharathKumarRavichandran Jan 19, 2019
3746f01
Remove phonenumberfield
BharathKumarRavichandran Jan 19, 2019
79d6fc7
Update api migrations
BharathKumarRavichandran Jan 19, 2019
2f28e77
Add hospital details route
BharathKumarRavichandran Jan 19, 2019
35bb71a
Add hospital details view
BharathKumarRavichandran Jan 19, 2019
dfa3606
Add CORS middleware to settings.py
BharathKumarRavichandran Jan 19, 2019
dbb4be5
[requirements] Add django-cors-headers, django-cors-middleware
BharathKumarRavichandran Jan 19, 2019
59d8007
Fix: Fix model object name in views
BharathKumarRavichandran Jan 19, 2019
9cbd099
Add photo-links to fixtures:Place.json
BharathKumarRavichandran Jan 19, 2019
37ffadc
[README.md] Update README
BharathKumarRavichandran Jan 23, 2019
97e29d4
Refactor: Move UI to frontend dir
BharathKumarRavichandran Nov 15, 2019
975a04f
Merge remote-tracking branch 'api/dev' into dev
BharathKumarRavichandran Nov 15, 2019
a0b0243
Refactor: Add API to backend
BharathKumarRavichandran Nov 15, 2019
4856489
[README] Add main README.md
BharathKumarRavichandran Nov 15, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 2 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,2 @@
# Tourist Mapper UI
Tourist Mapper UI is the frontend user interface repository of the project Tourist Mapper ideated for Pragyan hackathon 2019.

### API Repository
[tourist-mapper-api](https://github.com/BharathKumarRavichandran/tourist-mapper-api)

### Contributors
* [Bharath Kumar Ravichandran](https://github.com/BharathKumarRavichandran)
* [Hari Narayanan](https://github.com/lharinarayanan)
* [Vishal Saranathan](https://github.com/VishalS99)

### Template Author
[Colorlib](https://colorlib.com)

### Template Reference
[SRTdash](https://github.com/puikinsh/srtdash-admin-dashboard)
# Tourist Mapper
Tourist Mapper is the prototype and project ideated for Pragyan hackathon 2019.
121 changes: 121 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
.vscode
.idea

# dotcnf
*.cnf

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
49 changes: 49 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Tourist Mapper
The API for Tourist Mapper

### Prerequisites
* Install Python
* Install Python Package Manager (pip3) :
```
apt-get install python3-pip
```
* Install [virtualenv](https://gist.github.com/Geoyi/d9fab4f609e9f75941946be45000632b) :
```
apt-get install virtualenv
```
* Install [`mysqlclient`](https://pypi.org/project/mysqlclient/) prerequisites :
* You may need to install the Python and MySQL development headers and libraries like so :
```
sudo apt-get install python-dev default-libmysqlclient-dev
```
* If you are using python3 then you need to install python3-dev using the following command :
```
sudo apt-get install python3-dev
```
* Install from PyPI :
```
pip3 install mysqlclient
```

### Project Installation

1. Clone the repository - `git clone <remote-url>`
2. Go to the project directory - `cd <cloned-repo>`
3. Set up the environment :
* Create virtual environment files - `virtualenv venv`
* Activate virtual environment - `source venv/bin/activate`
4. Install dependencies - `pip3 install -r requirements.txt`
5. Create a MySQL database connection configuration file - `cp db.cnf.example db.cnf`
6. Enter your MySQL credentials in `db.cnf`:
* Set `user` and `password` to your localhost MySQL credentials.
* Create a database `tourist_mapper_api`
* Set `database = 'tourist_mapper_api'`
7. Run migrations - `python3 manage.py migrate`
8. Run seeders - `python3 manage.py loaddata */fixtures/*.json`
9. Start server - `python3 manage.py runserver`

#### Note
* This application runs only on python3.
* Everytime you install packages or run the server, activate your virtual environment - `source venv/bin/activate`
* To deactivate the activated virtual environment - run the command `deactivate` in terminal.
* If you install any python packages, please update the file `requirements.txt`
Empty file.
135 changes: 135 additions & 0 deletions backend/TouristMapper/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
"""
Django settings for TouristMapper project.

Generated by 'django-admin startproject' using Django 2.1.3.

For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'd=)9#a4iaw!2$ue61(kj$k4of)o406lyv4ngglg5dis+0!+%-m'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = [
'localhost',
'127.0.0.1'
]

# CORS rules
CORS_ALLOW_CREDENTIALS = True
CORS_ORIGIN_WHITELIST = (
'localhost:1234',
'*'
)
CORS_ORIGIN_ALLOW_ALL = True

# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'api.apps.ApiConfig',
'corsheaders',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
#'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'TouristMapper.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'TouristMapper.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'OPTIONS': {
'read_default_file': os.path.join(BASE_DIR, 'db.cnf'),
},
}
}


# Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Asia/Kolkata'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/

STATIC_URL = '/static/'
8 changes: 8 additions & 0 deletions backend/TouristMapper/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.contrib import admin
from django.urls import path, include
from django.conf.urls import url

urlpatterns = [
path('admin/', admin.site.urls),
path('api/', include('api.urls')),
]
16 changes: 16 additions & 0 deletions backend/TouristMapper/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for TouristMapper project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'TouristMapper.settings')

application = get_wsgi_application()
Empty file added backend/api/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions backend/api/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
5 changes: 5 additions & 0 deletions backend/api/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class ApiConfig(AppConfig):
name = 'api'
Empty file.
Loading