from django.shortcuts import render
import os
import json

module_dir = os.path.dirname(__file__)  # get current directory

# Create your views here.
def home(request):
    context = {}
    return render(request, "index.html", context)


def news(request):
    context = {}
    return render(request, "news.html", context)


def permanent_business(request):
    context = {}
    return render(request, "permanent_business.html", context)


def map(request):
    context = {}
    return render(request, "map.html", context)


def disponibility(request):
    context = {}
    return render(request, "disponibility.html", context)


def general(request):
    context = {}
    return render(request, "general.html", context)


def rules(request):
    context = {}
    return render(request, "rules.html", context)


def instalations_services(request):
    context = {}
    return render(request, "instalations_services.html", context)


def atms(request):
    context = {}
    return render(request, "atms.html", context)


def instalations(request):
    context = {}
    return render(request, "instalations.html", context)


def elevators(request):
    context = {}
    return render(request, "elevators.html", context)


def locals(request):
    context = {}
    return render(request, "locals.html", context)


def about_us(request):
    context = {}

    file_path = os.path.join(module_dir, '../condominios/static/files/directory.json')
    data = open(file_path).read()
    directory_data = json.loads(data)

    context["directory_data"] = directory_data

    return render(request, "about_us.html", context)


def directory(request):
    context = {}
    return render(request, "directory.html", context)


def contact(request):
    context = {}
    return render(request, "contact.html", context)

@@ -50,16 +50,46 @@
 ort json
+%0Aimport psycopg2%0Aimport pyodbc
 %0A%0Amodule
@@ -200,32 +200,934 @@
     context = %7B%7D
+%0A%0A    server = '200.23.150.13%5CSQL2008'%0A    database = 'Cintermex_Prod'%0A    username = 'sa'%0A    password = '2333'%0A    driver = '%7BSQL Server Native Client 11.0%7D'%0A    cnxn = pyodbc.connect(%0A        'DRIVER=' + driver + ';PORT=61451;SERVER=' + server + ';PORT=61451;DATABASE=' + database + ';UID=' + username + ';PWD=' + password)%0A%0A    try:%0A        #conn = psycopg2.connect(database=%22Cintermex_Prod%5CSQL2008%22, user=%22sa%22, host=%22200.23.150.13%22, password=%222333%22)%0A        #conn.close()%0A%0A        server = '200.23.150.13'%0A        database = 'Cintermex_Prod'%0A        username = 'sa'%0A        password = '2333'%0A        driver = '%7BODBC Driver 13 for SQL Server%7D'%0A        cnxn = pyodbc.connect(%0A            'DRIVER=' + driver + ';PORT=61451;SERVER=' + server + ';PORT=1443;DATABASE=' + database + ';UID=' + username + ';PWD=' + password)%0A%0A        print %22We are happy!%22%0A    except:%0A        print %22we are not happy :(%22%0A%0A
 %0A    return rend

add db comms