surajit003 / valentis

Clinic Management system built using Django and Python
1 stars 2 forks source link

Please not work on mac #1

Open draliiiiii opened 3 years ago

draliiiiii commented 3 years ago

After i changed db in settings to postgres and i install all requirements then try migration then Error Medication module

valentis-master drderma2030$ python3 manage.py migrate

Traceback (most recent call last):

File "manage.py", line 22, in

execute_from_command_line(sys.argv)

File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-package

s/django/core/management/init.py", line 401, in execute_from_command_line

utility.execute()

File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-package

s/django/core/management/init.py", line 377, in execute

django.setup()

File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-package

s/django/init.py", line 24, in setup

apps.populate(settings.INSTALLED_APPS)

File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-package

s/django/apps/registry.py", line 114, in populate

app_config.import_models()

File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-package

s/django/apps/config.py", line 211, in import_models

self.models_module = import_module(models_module_name)

File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__

init__.py", line 127, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

File "", line 1014, in _gcd_import

File "", line 991, in _find_and_load

File "", line 975, in _find_and_load_unlocked

File "", line 671, in _load_unlocked

File "", line 783, in exec_module

File "", line 219, in _call_with_frames_removed

File "/Users/drderma2030/Desktop/valentis-master/medication/models.py", line 10, i

n

from django_extensions.db.fields import fields as extension_fields

ImportError: cannot import name 'fields' from 'django_extensions.db.fields' (/Librar

y/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django_extens

ions/db/fields/init.py)

This medication module how i fix to run it

from django.urls import reverse from django_extensions.db.fields import AutoSlugField from django.db.models import * from django.conf import settings from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.contrib.auth import get_user_model from django.contrib.auth import models as auth_models from django.db import models as models from django_extensions.db.fields import fields as extension_fields

import uuid

class MyDawa(models.Model): brand = models.CharField(max_length=255) size = models.CharField(max_length=300) price = models.CharField(max_length=300)

class Meta:
    ordering = ('brand',)

def __str__(self):
    return self.brand + " : " + self.size + ":" + self.price

class Medication(models.Model):

# Fields
slug = extension_fields.AutoSlugField(populate_from='patient_no', blank=True)
created = models.DateTimeField(auto_now_add=True, editable=False)
last_updated = models.DateTimeField(auto_now=True, editable=False)
prescription_id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
triage_id = models.CharField(max_length=255, blank=True)
email = models.CharField(max_length=50, blank=True)
patient_no = models.CharField(max_length=30)
patient_name = models.TextField(max_length=100)
address = models.TextField(max_length=100)
physical_address = models.TextField(max_length=100, blank=True)
phone_number = models.CharField(max_length=30)
signature = models.BinaryField(null=True, blank=True)
prescription = models.TextField(max_length=400)
draliiiiii commented 3 years ago

drandroderma@gmail.com

surajit003 commented 3 years ago

@draliiiiii - Will have a look

draliiiiii commented 3 years ago

Thanks

draliiiiii commented 3 years ago

I wish i can run it for dermatology and aesthetic clinic

draliiiiii commented 3 years ago

this my settings.py

import os

import datetime

from decouple import config

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/1.10/howto/deployment/checklist/

SECURITY WARNING: keep the secret key used in production secret!

SECRET_KEY = os.environ.get('SECRET_KEY', 'CHANGEME')

SECURITY WARNING: don't run with debug turned on in production!

DEBUG = True

ALLOWED_HOSTS = ['*']

Custom user model

AUTH_USER_MODEL = 'account.CustomUser'

Custom authentication backend using email and password

AUTHENTICATION_BACKENDS = ('valentisHealth.backends.EmailAuthBackend',

                       'django.contrib.auth.backends.ModelBackend',

                       )

URL to redirect to if one ain't logged in

LOGIN_URL = '/account/log-in/'

LOGIN_REDIRECT_URL = '/registration/'

LOGIN_EXEMPT_URLS =['127.0.0.1',]

Application definition

INSTALLED_APPS = [

'account',

'django.contrib.admin',

'django.contrib.auth',

'django.contrib.contenttypes',

'django.contrib.sessions',

'django.contrib.messages',

'django.contrib.staticfiles',

'django.contrib.humanize',

'django_extensions',

'crispy_forms',

'rest_framework',

'rest_framework.authtoken',

'registration',

'nurse',

'clinic',

'medication',

'tests',

'payments',

'workflow',

# 'session_security',

]

MIDDLEWARE = [

'django.middleware.security.SecurityMiddleware',

'django.contrib.sessions.middleware.SessionMiddleware',

'django.middleware.common.CommonMiddleware',

'django.middleware.csrf.CsrfViewMiddleware',

'django.contrib.auth.middleware.AuthenticationMiddleware',

'django.contrib.messages.middleware.MessageMiddleware',

'django.middleware.clickjacking.XFrameOptionsMiddleware',

# 'valentisHealth.middleware.LoginRequiredMiddleware',

# 'session_security.middleware.SessionSecurityMiddleware',

]

ROOT_URLCONF = 'valentisHealth.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',

        ],

        'libraries':{'custom_tags':'templatetags.custom_tags'}

    },

},

]

WSGI_APPLICATION = 'valentisHealth.wsgi.application'

Database

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

DATABASES = {

'default': {

    'ENGINE': 'django.db.backends.postgresql_psycopg2',

    'NAME': 'dermisdb',

    'USER': 'postgres',

    'PASSWORD': ‘uytrr0',

    'HOST': 'localhost',

    'PORT': '5432',

}

}

Password validation

# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [

{'NAME':

'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'},

noqa

{'NAME':

'django.contrib.auth.password_validation.MinimumLengthValidator'}, # noqa

{'NAME':

'django.contrib.auth.password_validation.CommonPasswordValidator'}, # noqa

{'NAME':

'django.contrib.auth.password_validation.NumericPasswordValidator'}, # noqa

]

Internationalization

https://docs.djangoproject.com/en/1.10/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Africa/Nairobi'

USE_I18N = True

USE_L10N = True

USE_TZ = True

MEDIA_URL = '/media/'

MEDIA_ROOT = os.path.join(BASE_DIR, "media")

Static files (CSS, JavaScript, Images)

https://docs.djangoproject.com/en/1.10/howto/static-files/

STATICFILES_DIRS = (

os.path.join(BASE_DIR, 'static'),

)

STATIC_ROOT = os.path.join(BASE_DIR, 'static')

STATIC_URL = '/static/'

Email settings

EMAIL_BACKEND = ('django.core.mail.backends.smtp.EmailBackend')

EMAIL_HOST_USER = ('EMAIL_HOST_USER')

EMAIL_HOST = ('localhost')

EMAIL_PORT = 25

EMAIL_USE_TLS = True

EMAIL_HOST_PASSWORD = ('EMAIL_HOST_PASSWORD')

SERVER_EMAIL = ''

DEFAULT_FROM_EMAIL = ('DEFAULT_FROM_EMAIL')

EMAIL_DEBUG = True

#

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

SECURE_SSL_REDIRECT = True

SESSION_COOKIE_SECURE = False

CSRF_COOKIE_SECURE = False

#

SESSION_EXPIRE_AT_BROWSER_CLOSE = True

TIME = 120*60

SESSION_COOKIE_AGE = TIME #change expired session

SESSION_IDLE_TIMEOUT = TIME #logout

REST_FRAMEWORK = {

'DEFAULT_PERMISSION_CLASSES': (

    'rest_framework.permissions.IsAuthenticated',

),

'DEFAULT_AUTHENTICATION_CLASSES': (

    'rest_framework_jwt.authentication.JSONWebTokenAuthentication',

    'rest_framework.authentication.SessionAuthentication',

    'rest_framework.authentication.BasicAuthentication',

),

}

JWT_AUTH = {

'JWT_ALLOW_REFRESH': True,

'JWT_EXPIRATION_DELTA': datetime.timedelta(hours=1),

'JWT_REFRESH_EXPIRATION_DELTA': datetime.timedelta(days=7),

'JWT_RESPONSE_PAYLOAD_HANDLER':

'valentisHealth.backends.jwt_response_payload_handler',

}

MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage

this my lisrt rquermints

drderma2030$ pip3 freeze

absl-py==0.10.0

amqp==1.4.9

anyjson==0.3.3

appdirs==1.4.4

asgiref==3.2.10

astunparse==1.6.3

billiard==3.3.0.23

cachetools==4.1.1

celery==3.1.25

certifi==2020.6.20

chardet==3.0.4

distlib==0.3.1

Django==3.1

django-appconf==1.0.4

django-axes==1.7.0

django-celery==3.2.2

django-compressor==2.2

django-crispy-forms==1.9.2

django-extensions==3.0.5

django-reversion==3.0.1

django-upload-form==0.4.2

django-widget-tweaks==1.4.8

djangorestframework==3.10.2

djangorestframework-jwt==1.11.0

ffs==0.0.8.2

filelock==3.0.12

gast==0.3.3

google-auth==1.20.1

google-auth-oauthlib==0.4.1

google-pasta==0.2.0

grpcio==1.31.0

h5py==2.10.0

html5lib==1.1

idna==2.8

Jinja2==2.10.1

Keras-Preprocessing==1.1.2

kombu==3.0.37

letter==0.5

Markdown==3.2.2

MarkupSafe==1.1.1

numpy==1.18.5

oauthlib==3.1.0

opal==0.18.3

opt-einsum==3.3.0

Pillow==7.2.0

pipenv==2020.6.2

protobuf==3.13.0

psycopg2-binary==2.8.5

pyasn1==0.4.8

pyasn1-modules==0.2.8

PyJWT==1.7.1

PyPDF2==1.26.0

python-dateutil==2.8.0

python-decouple==3.3

pytz==2020.1

rcssmin==1.0.6

reportlab==3.5.47

requests==2.22.0

requests-oauthlib==1.3.0

rjsmin==1.0.12

rsa==4.6

scipy==1.4.1

six==1.15.0

sqlparse==0.3.1

tensorboard==2.3.0

tensorboard-plugin-wit==1.7.0

tensorflow==2.3.0

tensorflow-estimator==2.3.0

termcolor==1.1.0

urllib3==1.25.10

virtualenv==20.0.30

virtualenv-clone==0.5.4

webencodings==0.5.1

Werkzeug==1.0.1

wrapt==1.12.1

xhtml2pdf==0.2.4Git

brew list

buildapp gettext krb5 pcre2 readline vapor

ctls git libressl pkg-config sbcl xz

gdbm icu4c openssl@1.1 python@3.8 sqlite

GitHub

‫في الثلاثاء، 25 أغسطس 2020 في 9:11 م تمت كتابة ما يلي بواسطة ‪Surajit Das‬‏ ‪notifications@github.com‬‏:‬

@draliiiiii https://github.com/draliiiiii - Will have a look

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/surajit003/valentis/issues/1#issuecomment-680187778, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQRSZUHRBT7OTQODBZLY353SCP5GPANCNFSM4QK2DZQA .

draliiiiii commented 3 years ago

I update all requirements version to your app same and no run

absl-py==0.10.0 amqp==1.4.9 anyjson==0.3.3 appdirs==1.4.4 asgiref==3.2.10 astroid==1.6.1 astunparse==1.6.3 billiard==3.3.0.23 cachetools==4.1.1 celery==3.1.25 certifi==2020.6.20

chardet==3.0.4 distlib==0.3.1 Django==3.1 django-appconf==1.0.4 django-axes==1.7.0 django-celery==3.2.2 django-compressor==2.2 django-cors-headers==3.4.0 django-crispy-forms==1.9.2 django-extensions==1.9.9 django-filter==1.1.0 django-model-utils==3.1.1 django-render-block==0.5 django-reversion==3.0.1 django-upload-form==0.4.2 django-widget-tweaks==1.4.8 djangorestframework==3.10.2 djangorestframework-jwt==1.11.0 ffs==0.0.8.2 filelock==3.0.12

gast==0.3.3 google-auth==1.20.1 google-auth-oauthlib==0.4.1 google-pasta==0.2.0 grpcio==1.31.0 h5py==2.10.0 html5lib==1.1 httplib2==0.10.3 idna==2.8 isort==4.2.15

isort==4.2.15 Jinja2==2.10.1 joblib==0.16.0 jsonfield==2.0.2 Keras-Preprocessing==1.1.2 kombu==3.0.37 lazy-object-proxy==1.3.1 letter==0.5 Markdown==3.2.2 MarkupSafe==1.1.1 mccabe==0.6.1

numpy==1.18.5 oauthlib==3.1.0 opal==0.18.3 opt-einsum==3.3.0 Pillow==7.2.0 pipenv==2020.6.2 protobuf==3.13.0 psycopg2-binary==2.8.5 pyasn1==0.4.8 pyasn1-modules==0.2.8 PyJWT==1.7.1 PyPDF2==1.26.0 python-dateutil==2.8.0 python-decouple==3.3 pytz==2020.1 rcssmin==1.0.6 reportlab==3.5.47 requests==2.22.0 requests-oauthlib==1.3.0 rjsmin==1.0.12

rsa==4.6 scikit-learn==0.23.2 scipy==1.4.1 six==1.15.0 sqlparse==0.3.1 ttensorboard==2.3.0 tensorboard-plugin-wit==1.7.0 tensorflow==2.3.0 tensorflow-estimator==2.3.0 termcolor==1.1.0

threadpoolctl==2.1.0 typing==3.7.4.3 urllib3==1.25.10 virtualenv==20.0.30 virtualenv-clone==0.5.4 webencodings==0.5.1 Werkzeug==1.0.1 wrapt==1.12.1 xhtml2pdf==0.2.4

surajit003 commented 3 years ago

@draliiiiii - Please check back in 48hrs

draliiiiii commented 3 years ago

Ok but you think problem from me or in app modules???

draliiiiii commented 3 years ago

I still wait u

draliiiiii commented 3 years ago

Dear its working in n your pc or

draliiiiii commented 3 years ago

Tou didn't answer contact me on mail

draliiiiii commented 3 years ago

Okay i change backend email to deflut and open app but links url on frontend pages how open in browser there eerors from $

draliiiiii commented 3 years ago

Still when enter account log in error html multiple authritcation backend user

draliiiiii commented 3 years ago
Request Method: POST

http://127.0.0.1:8000/account/log-in/?next=/clinic/patientvisit/doctor/1/ 3.1 ValueError You have multiple authentication backends configured and therefore must provide the backend argument or set the backend attribute on the user. /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/contrib/auth/init.py, line 117, in login /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 3.8.1 ['/Users/drderma2030/Desktop/working django projects/projects/valentis-master', '/Library/Frameworks/Python.framework/Versions/3.8/lib/python38.zip', '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8', '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/lib-dynload', '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages'] Fri, 18 Sep 2020 05:47:34 +0300

draliiiiii commented 3 years ago

How add doctors