horilla-opensource / horilla

Horilla is a free and open source HR software.
https://www.horilla.com/
GNU Lesser General Public License v2.1
163 stars 109 forks source link

Ubuntu - migrate fails with 'django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'address' used in key specification without a key length") #84

Closed curtishall closed 2 months ago

curtishall commented 7 months ago

Bug Report

Installing under Ubuntu 22.04, latest updates.

Description

Using mysql, confirmed credentials.

root@horilla:~/horilla# python3 manage.py makemigrations
Migrations for 'horilla_audit':
  horilla_audit/migrations/0001_initial.py
    - Create model AuditTag
    - Create model HistoryTrackingFields
Migrations for 'asset':
  asset/migrations/0001_initial.py
    - Create model Asset
    - Create model AssetAssignment
    - Create model AssetCategory
    - Create model AssetDocuments
    - Create model AssetLot
    - Create model AssetReport
    - Create model ReturnImages
    - Create model AssetRequest
  asset/migrations/0002_initial.py
    - Add field requested_employee_id to assetrequest
    - Add field asset_id to assetreport
    - Add field company_id to assetlot
    - Add field asset_report to assetdocuments
    - Add field company_id to assetcategory
    - Add field asset_id to assetassignment
    - Add field assign_images to assetassignment
    - Add field assigned_by_employee_id to assetassignment
    - Add field assigned_to_employee_id to assetassignment
    - Add field return_images to assetassignment
    - Add field asset_category_id to asset
    - Add field asset_lot_number_id to asset
    - Add field owner to asset
Migrations for 'attendance':
  attendance/migrations/0001_initial.py
    - Create model Attendance
    - Create model AttendanceActivity
    - Create model AttendanceGeneralSetting
    - Create model AttendanceLateComeEarlyOut
    - Create model AttendanceOverTime
    - Create model AttendancerequestComment
    - Create model AttendancerequestFile
    - Create model AttendanceValidationCondition
    - Create model GraceTime
    - Create model HistoricalAttendance
    - Create model PenaltyAccount
  attendance/migrations/0002_initial.py
    - Add field employee_id to penaltyaccount
    - Add field late_early_id to penaltyaccount
    - Add field leave_request_id to penaltyaccount
    - Add field leave_type_id to penaltyaccount
    - Add field attendance_day to historicalattendance
    - Add field employee_id to historicalattendance
    - Add field history_relation to historicalattendance
    - Add field history_tags to historicalattendance
    - Add field history_user to historicalattendance
    - Add field shift_id to historicalattendance
    - Add field work_type_id to historicalattendance
    - Add field company_id to gracetime
    - Add field company_id to attendancevalidationcondition
    - Add field employee_id to attendancerequestcomment
    - Add field files to attendancerequestcomment
    - Add field request_id to attendancerequestcomment
    - Add field employee_id to attendanceovertime
    - Add field attendance_id to attendancelatecomeearlyout
    - Add field employee_id to attendancelatecomeearlyout
    - Add field company_id to attendancegeneralsetting
    - Add field employee_id to attendanceactivity
    - Add field shift_day to attendanceactivity
    - Add field attendance_day to attendance
    - Add field employee_id to attendance
    - Add field shift_id to attendance
    - Add field work_type_id to attendance
    - Alter unique_together for attendanceovertime (1 constraint(s))
    - Alter unique_together for attendancelatecomeearlyout (1 constraint(s))
    - Alter unique_together for attendance (1 constraint(s))
Migrations for 'base':
  base/migrations/0001_initial.py
    - Create model Announcement
    - Create model AnnouncementComment
    - Create model AnnouncementExpire
    - Create model AnnouncementView
    - Create model Attachment
    - Create model BaserequestFile
    - Create model Company
    - Create model Department
    - Create model DynamicEmailConfiguration
    - Create model DynamicPagination
    - Create model EmailLog
    - Create model EmployeeShift
    - Create model EmployeeShiftDay
    - Create model EmployeeShiftSchedule
    - Create model EmployeeType
    - Create model HistoricalRotatingShiftAssign
    - Create model HistoricalRotatingWorkTypeAssign
    - Create model HistoricalShiftRequest
    - Create model HistoricalWorkTypeRequest
    - Create model JobPosition
    - Create model JobRole
    - Create model MultipleApprovalCondition
    - Create model MultipleApprovalManagers
    - Create model RotatingShift
    - Create model RotatingShiftAssign
    - Create model RotatingWorkType
    - Create model RotatingWorkTypeAssign
    - Create model ShiftRequest
    - Create model ShiftrequestComment
    - Create model Tags
    - Create model WorkType
    - Create model WorkTypeRequest
    - Create model WorktyperequestComment
  base/migrations/0002_initial.py
    - Add field employee_id to worktyperequestcomment
    - Add field files to worktyperequestcomment
    - Add field request_id to worktyperequestcomment
    - Add field employee_id to worktyperequest
    - Add field previous_work_type_id to worktyperequest
    - Add field work_type_id to worktyperequest
    - Add field company_id to worktype
    - Add field company_id to tags
    - Add field employee_id to shiftrequestcomment
    - Add field files to shiftrequestcomment
    - Add field request_id to shiftrequestcomment
    - Add field employee_id to shiftrequest
    - Add field previous_shift_id to shiftrequest
    - Add field reallocate_to to shiftrequest
    - Add field shift_id to shiftrequest
    - Add field current_work_type to rotatingworktypeassign
    - Add field employee_id to rotatingworktypeassign
    - Add field next_work_type to rotatingworktypeassign
    - Add field rotating_work_type_id to rotatingworktypeassign
    - Add field employee_id to rotatingworktype
    - Add field work_type1 to rotatingworktype
    - Add field work_type2 to rotatingworktype
    - Add field current_shift to rotatingshiftassign
    - Add field employee_id to rotatingshiftassign
    - Add field next_shift to rotatingshiftassign
    - Add field rotating_shift_id to rotatingshiftassign
    - Add field employee_id to rotatingshift
    - Add field shift1 to rotatingshift
    - Add field shift2 to rotatingshift
    - Add field condition_id to multipleapprovalmanagers
    - Add field department to multipleapprovalcondition
    - Add field company_id to jobrole
    - Add field job_position_id to jobrole
    - Add field company_id to jobposition
    - Add field department_id to jobposition
    - Add field employee_id to historicalworktyperequest
    - Add field history_relation to historicalworktyperequest
    - Add field history_tags to historicalworktyperequest
    - Add field history_user to historicalworktyperequest
    - Add field previous_work_type_id to historicalworktyperequest
    - Add field work_type_id to historicalworktyperequest
    - Add field employee_id to historicalshiftrequest
    - Add field history_relation to historicalshiftrequest
    - Add field history_tags to historicalshiftrequest
    - Add field history_user to historicalshiftrequest
    - Add field previous_shift_id to historicalshiftrequest
    - Add field reallocate_to to historicalshiftrequest
    - Add field shift_id to historicalshiftrequest
    - Add field current_work_type to historicalrotatingworktypeassign
    - Add field employee_id to historicalrotatingworktypeassign
    - Add field history_relation to historicalrotatingworktypeassign
    - Add field history_tags to historicalrotatingworktypeassign
    - Add field history_user to historicalrotatingworktypeassign
    - Add field next_work_type to historicalrotatingworktypeassign
    - Add field rotating_work_type_id to historicalrotatingworktypeassign
    - Add field current_shift to historicalrotatingshiftassign
    - Add field employee_id to historicalrotatingshiftassign
    - Add field history_relation to historicalrotatingshiftassign
    - Add field history_tags to historicalrotatingshiftassign
    - Add field history_user to historicalrotatingshiftassign
    - Add field next_shift to historicalrotatingshiftassign
    - Add field rotating_shift_id to historicalrotatingshiftassign
    - Add field company_id to employeetype
    - Add field company_id to employeeshiftschedule
    - Add field day to employeeshiftschedule
    - Add field shift_id to employeeshiftschedule
    - Add field company_id to employeeshiftday
    - Add field company_id to employeeshift
    - Add field days to employeeshift
    - Add field grace_time_id to employeeshift
    - Add field company_id to emaillog
    - Add field user_id to dynamicpagination
    - Add field company_id to dynamicemailconfiguration
    - Add field company_id to department
    - Alter unique_together for company (1 constraint(s))
    - Add field announcement to announcementview
    - Add field user to announcementview
    - Add field announcement_id to announcementcomment
    - Add field employee_id to announcementcomment
    - Add field attachments to announcement
    - Add field department to announcement
    - Add field employees to announcement
    - Add field job_position to announcement
    - Alter unique_together for jobrole (1 constraint(s))
    - Alter unique_together for employeeshiftschedule (1 constraint(s))
Migrations for 'employee':
  employee/migrations/0001_initial.py
    - Create model Actiontype
    - Create model BonusPoint
    - Create model Employee
    - Create model EmployeeTag
    - Create model EmployeeWorkInformation
    - Create model PolicyMultipleFile
    - Create model Policy
    - Create model HistoricalEmployeeWorkInformation
    - Create model HistoricalBonusPoint
    - Create model EmployeeNote
    - Create model EmployeeGeneralSetting
    - Create model EmployeeBankDetails
    - Create model DisciplinaryAction
    - Add field employee_id to bonuspoint
    - Create constraint unique_badge_id on model employee
    - Alter unique_together for employee (1 constraint(s))
Migrations for 'helpdesk':
  helpdesk/migrations/0001_initial.py
    - Create model FAQCategory
    - Create model TicketType
    - Create model Ticket
    - Create model HistoricalTicket
    - Create model FAQ
    - Create model DepartmentManager
    - Create model Comment
    - Create model Attachment
Migrations for 'horilla_documents':
  horilla_documents/migrations/0001_initial.py
    - Create model DocumentRequest
    - Create model Document
Migrations for 'leave':
  leave/migrations/0001_initial.py
    - Create model AvailableLeave
    - Create model LeaveAllocationRequest
    - Create model LeaveRequest
    - Create model LeaverequestFile
    - Create model LeaveType
    - Create model LeaveRequestConditionApproval
    - Create model LeaverequestComment
    - Add field leave_type_id to leaverequest
    - Create model LeaveallocationrequestComment
    - Add field leave_type_id to leaveallocationrequest
    - Create model Holiday
    - Create model HistoricalLeaveRequest
    - Create model HistoricalLeaveAllocationRequest
    - Create model HistoricalAvailableLeave
    - Add field leave_type_id to availableleave
    - Create model CompanyLeave
    - Alter unique_together for availableleave (1 constraint(s))
Migrations for 'offboarding':
  offboarding/migrations/0001_initial.py
    - Create model EmployeeTask
    - Create model Offboarding
    - Create model OffboardingEmployee
    - Create model OffboardingStage
    - Create model OffboardingStageMultipleFile
    - Create model ResignationLetter
    - Create model OffboardingTask
    - Create model OffboardingNote
    - Create model OffboardingGeneralSetting
    - Add field stage_id to offboardingemployee
    - Create model HistoricalEmployeeTask
    - Create model ExitReason
    - Add field employee_id to employeetask
    - Add field task_id to employeetask
    - Alter unique_together for employeetask (1 constraint(s))
Migrations for 'payroll':
  payroll/migrations/0001_initial.py
    - Create model Allowance
    - Create model Contract
    - Create model Deduction
    - Create model EncashmentGeneralSettings
    - Create model FilingStatus
    - Create model MultipleCondition
    - Create model OverrideAttendance
    - Create model OverrideLeaveRequest
    - Create model OverrideWorkInfo
    - Create model Reimbursement
    - Create model ReimbursementMultipleAttachment
    - Create model WorkRecord
    - Create model TaxBracket
    - Create model ReimbursementrequestComment
    - Add field other_attachments to reimbursement
    - Create model Payslip
    - Create model PayrollSettings
    - Create model PayrollGeneralSetting
    - Create model LoanAccount
    - Create model HistoricalContract
    - Add field other_conditions to deduction
    - Add field specific_employees to deduction
    - Add field filing_status to contract
    - Add field job_position to contract
    - Add field job_role to contract
    - Add field shift to contract
    - Add field work_type to contract
    - Add field other_conditions to allowance
    - Add field shift_id to allowance
    - Add field specific_employees to allowance
    - Add field work_type_id to allowance
    - Alter unique_together for contract (1 constraint(s))
    - Alter unique_together for allowance (1 constraint(s))
Migrations for 'pms':
  pms/migrations/0001_initial.py
    - Create model EmployeeKeyResult
    - Create model EmployeeObjective
    - Create model Feedback
    - Create model Question
    - Create model QuestionTemplate
    - Create model QuestionOptions
    - Add field template_id to question
    - Create model Period
    - Create model KeyResultFeedback
    - Create model HistoricalEmployeeObjective
    - Create model HistoricalEmployeeKeyResult
    - Create model HistoricalComment
    - Add field question_template_id to feedback
    - Add field subordinate_id to feedback
    - Add field employee_objective_id to employeekeyresult
    - Create model Comment
    - Create model Answer
    - Create model AnonymousFeedback
Migrations for 'recruitment':
  recruitment/migrations/0001_initial.py
    - Create model Candidate
    - Create model Recruitment
    - Create model SkillZone
    - Create model Stage
    - Create model StageFiles
    - Create model StageNote
    - Create model RejectReason
    - Create model RejectedCandidate
    - Create model RecruitmentSurveyAnswer
    - Create model RecruitmentSurvey
    - Create model RecruitmentMailTemplate
    - Create model RecruitmentGeneralSetting
    - Create model HistoricalRejectedCandidate
    - Create model HistoricalCandidate
    - Add field recruitment_id to candidate
    - Add field referral to candidate
    - Add field stage_id to candidate
    - Create model SkillZoneCandidate
    - Create model CandidateRating
    - Alter unique_together for candidate (1 constraint(s))
Migrations for 'onboarding':
  onboarding/migrations/0001_initial.py
    - Create model CandidateTask
    - Create model OnboardingStage
    - Create model OnboardingTask
    - Create model OnboardingPortal
    - Create model HistoricalCandidateTask
    - Add field onboarding_task_id to candidatetask
    - Add field stage_id to candidatetask
    - Create model CandidateStage
Migrations for 'notifications':
  notifications/migrations/0001_initial.py
    - Create model Notification
root@horilla:~/horilla# python3 manage.py migrate       
System check identified some issues:

WARNINGS:
employee.Employee: (models.W036) MySQL does not support unique constraints with conditions.
        HINT: A constraint won't be created. Silence this warning if you don't care about it.
Operations to perform:
  Apply all migrations: admin, asset, attendance, auth, base, contenttypes, django_apscheduler, employee, helpdesk, horilla_audit, horilla_documents, leave, notifications, offboarding, onboarding, payroll, pms, recruitment, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying horilla_audit.0001_initial... OK
  Applying base.0001_initial... OK
  Applying employee.0001_initial... OK
  Applying asset.0001_initial... OK
  Applying asset.0002_initial... OK
  Applying leave.0001_initial... OK
  Applying attendance.0001_initial... OK
  Applying attendance.0002_initial... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying auth.0012_alter_user_first_name_max_length... OK
  Applying base.0002_initial...Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/mysql/base.py", line 75, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/connections.py", line 254, in query
    _mysql.connection.query(self, query)
MySQLdb.OperationalError: (1170, "BLOB/TEXT column 'address' used in key specification without a key length")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/horilla/manage.py", line 22, in <module>
    main()
  File "/root/horilla/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 106, in wrapper
    res = handle_func(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/commands/migrate.py", line 356, in handle
    post_migrate_state = executor.migrate(
  File "/usr/local/lib/python3.10/dist-packages/django/db/migrations/executor.py", line 135, in migrate
    state = self._migrate_all_forwards(
  File "/usr/local/lib/python3.10/dist-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
    state = self.apply_migration(
  File "/usr/local/lib/python3.10/dist-packages/django/db/migrations/executor.py", line 252, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/usr/local/lib/python3.10/dist-packages/django/db/migrations/migration.py", line 132, in apply
    operation.database_forwards(
  File "/usr/local/lib/python3.10/dist-packages/django/db/migrations/operations/models.py", line 659, in database_forwards
    alter_together(
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/base/schema.py", line 563, in alter_unique_together
    self.execute(self._create_unique_sql(model, fields))
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/base/schema.py", line 201, in execute
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 102, in execute
    return super().execute(sql, params)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 84, in _execute
    with self.db.wrap_database_errors:
  File "/usr/local/lib/python3.10/dist-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/mysql/base.py", line 75, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/connections.py", line 254, in query
    _mysql.connection.query(self, query)
django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'address' used in key specification without a key length")

[A brief description of the bug or issue you're encountering.]

Steps to Reproduce

Clean install of Ubuntu 22.04, install packages per instruction.

Environment

horilla-opensource commented 7 months ago

Hi @curtishall , We have tried to reproduce the issue mentioned above, but couldn't reproduce it. We have tested in Ubuntu 18, 20 and 22 with python version 3.8, 3.10 and 3.12. And also with blank database and test database provided. From the issue that we have seen in the report, we have added a solution to it which we think will work for you. Please use the latest code from the github and check again. If you still face the issues, please let us know.

With Regards, Team Horilla

curtishall commented 7 months ago

Thanks for the quick response. What file do I need to remove to start the database seeding process again?

makemigrations will not seed again even if I drop the database so I was deleting the entire directory and recloning but surely there is a better way.

horilla-opensource commented 7 months ago

Hi @curtishall , You don't have to remove any file to start the process again. If you are working on a new blank database, I would suggest that you remove all the migrations file from the apps and start again as a fresh start.

You can just run the makemigrations and migrate command again which will fix the issue.

Also we haven't created the fixtures for seeding the data into the database. Time being we have provided a test database within the repo itself for testing purpose which is already set inside the settings.py file.

We'll soon release the fixture along with a database manager for restoring, backing up and creating new database from the front end without the use of changing values from the backend. The RnD is currently under progress on this and features are completed. We are currently working on the method for dynamically changing the database from the frontend menu with which multiple database concept can be implemented.

With Regards, Team Horilla

curtishall commented 7 months ago

Still having the same issue:

alter_unique_together
    self.execute(self._create_unique_sql(model, fields))
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/base/schema.py", line 201, in execute
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 102, in execute
    return super().execute(sql, params)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 84, in _execute
    with self.db.wrap_database_errors:
  File "/usr/local/lib/python3.10/dist-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/mysql/base.py", line 75, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/connections.py", line 254, in query
    _mysql.connection.query(self, query)
django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'address' used in key specification without a key length")
horilla-opensource commented 7 months ago

Are you testing with the test database provided in the git or a new blank database?

curtishall commented 7 months ago

I did not use the database provided. I ended up switching to mariadb and was able to complete the install.

horilla-opensource commented 7 months ago

Hi @curtishall , Happy to hear that. We'll try to solve the issue you faced with the mysql database.

With Regards, Team Horilla

curtishall commented 7 months ago

Last question...the server runs on localhost 8000 but doesn't bind to any other interface. How can I access the app remotely? I tried nginx proxy manager and it says bad gateway.

curtishall commented 7 months ago

If you can update the documentation to show how to bind to all interfaces:

python3 manage.py runserver 0.0.0.0:8000

And then if using a proxy edit CSRF_TRUSTED_ORIGINS in horilla/settings.py and put in the FQDN with the schema (https://....)

horilla-opensource commented 7 months ago

Hi @curtishall , Thanks for the suggestion. We'll add it in the documentation. We are on a major update to the git documentation and we'll add it to the docs.

If you can update the documentation to show how to bind to all interfaces:

python3 manage.py runserver 0.0.0.0:8000

And then if using a proxy edit CSRF_TRUSTED_ORIGINS in horilla/settings.py and put in the FQDN with the schema (https://....)

With Regards, Team Horilla

horilla-opensource commented 7 months ago

Last question...the server runs on localhost 8000 but doesn't bind to any other interface. How can I access the app remotely? I tried nginx proxy manager and it says bad gateway.

Is this fixed? If you are hosting locally in your system and want to host to the system in your network, you can use your public ip and share it with your colleagues and use a cloud system and host Horilla in it.

With Regards, Team Horilla

curtishall commented 7 months ago

Yes, fixed.

nik-at-work commented 4 months ago

Hi @curtishall , I have come across the same issue. I just tried with the latest code, but still facing the exact same error mentioned above. I would like to use mysql only. Is there any solution?

I followed the exact same steps - I have ubuntu 20.4 , python 3.8.10 and Django 4.2.11

$ sudo python3 manage.py migrate
System check identified some issues:

WARNINGS:
employee.Employee: (models.W036) MySQL does not support unique constraints with conditions.
    HINT: A constraint won't be created. Silence this warning if you don't care about it.
Operations to perform:
  Apply all migrations: admin, asset, attendance, auth, base, contenttypes, django_apscheduler, employee, helpdesk, horilla_audit, horilla_documents, leave, notifications, offboarding, onboarding, payroll, pms, recruitment, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying horilla_audit.0001_initial... OK
  Applying base.0001_initial... OK
  Applying employee.0001_initial...Job "recurring_holiday (trigger: interval[0:00:10], next run at: 2024-05-01 22:58:42 IST)" raised an exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/mysql/base.py", line 75, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python3.8/dist-packages/MySQLdb/cursors.py", line 179, in execute
    res = self._query(mogrified_query)
  File "/usr/local/lib/python3.8/dist-packages/MySQLdb/cursors.py", line 330, in _query
    db.query(q)
  File "/usr/local/lib/python3.8/dist-packages/MySQLdb/connections.py", line 261, in query
    _mysql.connection.query(self, query)
MySQLdb.ProgrammingError: (1146, "Table 'horilla.leave_holiday' doesn't exist")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/apscheduler/executors/base.py", line 125, in run_job
    retval = job.func(*job.args, **job.kwargs)
  File "/home/nishit/Documents/Lab/horilla/horilla/leave/scheduler.py", line 44, in recurring_holiday
    for recurring_holiday in recurring_holidays:
  File "/usr/local/lib/python3.8/dist-packages/django/db/models/query.py", line 398, in __iter__
    self._fetch_all()
  File "/usr/local/lib/python3.8/dist-packages/django/db/models/query.py", line 1881, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/usr/local/lib/python3.8/dist-packages/django/db/models/query.py", line 91, in __iter__
    results = compiler.execute_sql(
  File "/usr/local/lib/python3.8/dist-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py", line 102, in execute
    return super().execute(sql, params)
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.8/dist-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/mysql/base.py", line 75, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python3.8/dist-packages/MySQLdb/cursors.py", line 179, in execute
    res = self._query(mogrified_query)
  File "/usr/local/lib/python3.8/dist-packages/MySQLdb/cursors.py", line 330, in _query
    db.query(q)
  File "/usr/local/lib/python3.8/dist-packages/MySQLdb/connections.py", line 261, in query
    _mysql.connection.query(self, query)
django.db.utils.ProgrammingError: (1146, "Table 'horilla.leave_holiday' doesn't exist")
Job "leave_reset (trigger: interval[0:00:10], next run at: 2024-05-01 22:58:42 IST)" raised an exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/mysql/base.py", line 75, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python3.8/dist-packages/MySQLdb/cursors.py", line 179, in execute
    res = self._query(mogrified_query)
  File "/usr/local/lib/python3.8/dist-packages/MySQLdb/cursors.py", line 330, in _query
    db.query(q)
  File "/usr/local/lib/python3.8/dist-packages/MySQLdb/connections.py", line 261, in query
    _mysql.connection.query(self, query)
MySQLdb.ProgrammingError: (1146, "Table 'horilla.leave_leavetype' doesn't exist")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/apscheduler/executors/base.py", line 125, in run_job
    retval = job.func(*job.args, **job.kwargs)
  File "/home/nishit/Documents/Lab/horilla/horilla/leave/scheduler.py", line 16, in leave_reset
    for leave_type in leave_types:
  File "/usr/local/lib/python3.8/dist-packages/django/db/models/query.py", line 398, in __iter__
    self._fetch_all()
  File "/usr/local/lib/python3.8/dist-packages/django/db/models/query.py", line 1881, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/usr/local/lib/python3.8/dist-packages/django/db/models/query.py", line 91, in __iter__
    results = compiler.execute_sql(
  File "/usr/local/lib/python3.8/dist-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py", line 102, in execute
    return super().execute(sql, params)
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.8/dist-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/mysql/base.py", line 75, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python3.8/dist-packages/MySQLdb/cursors.py", line 179, in execute
    res = self._query(mogrified_query)
  File "/usr/local/lib/python3.8/dist-packages/MySQLdb/cursors.py", line 330, in _query
    db.query(q)
  File "/usr/local/lib/python3.8/dist-packages/MySQLdb/connections.py", line 261, in query
    _mysql.connection.query(self, query)
django.db.utils.ProgrammingError: (1146, "Table 'horilla.leave_leavetype' doesn't exist")
 OK
  Applying asset.0001_initial... OK
  Applying asset.0002_initial... OK
  Applying leave.0001_initial... OK
  Applying attendance.0001_initial... OK
  Applying attendance.0002_initial... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying auth.0012_alter_user_first_name_max_length... OK
  Applying base.0002_initial...Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/mysql/base.py", line 75, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python3.8/dist-packages/MySQLdb/cursors.py", line 179, in execute
    res = self._query(mogrified_query)
  File "/usr/local/lib/python3.8/dist-packages/MySQLdb/cursors.py", line 330, in _query
    db.query(q)
  File "/usr/local/lib/python3.8/dist-packages/MySQLdb/connections.py", line 261, in query
    _mysql.connection.query(self, query)
MySQLdb.OperationalError: (1170, "BLOB/TEXT column 'address' used in key specification without a key length")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    main()
  File "manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.8/dist-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.8/dist-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.8/dist-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.8/dist-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.8/dist-packages/django/core/management/base.py", line 106, in wrapper
    res = handle_func(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/django/core/management/commands/migrate.py", line 356, in handle
    post_migrate_state = executor.migrate(
  File "/usr/local/lib/python3.8/dist-packages/django/db/migrations/executor.py", line 135, in migrate
    state = self._migrate_all_forwards(
  File "/usr/local/lib/python3.8/dist-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
    state = self.apply_migration(
  File "/usr/local/lib/python3.8/dist-packages/django/db/migrations/executor.py", line 252, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/usr/local/lib/python3.8/dist-packages/django/db/migrations/migration.py", line 132, in apply
    operation.database_forwards(
  File "/usr/local/lib/python3.8/dist-packages/django/db/migrations/operations/models.py", line 659, in database_forwards
    alter_together(
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/base/schema.py", line 563, in alter_unique_together
    self.execute(self._create_unique_sql(model, fields))
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/base/schema.py", line 201, in execute
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py", line 102, in execute
    return super().execute(sql, params)
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.8/dist-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.8/dist-packages/django/db/backends/mysql/base.py", line 75, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python3.8/dist-packages/MySQLdb/cursors.py", line 179, in execute
    res = self._query(mogrified_query)
  File "/usr/local/lib/python3.8/dist-packages/MySQLdb/cursors.py", line 330, in _query
    db.query(q)
  File "/usr/local/lib/python3.8/dist-packages/MySQLdb/connections.py", line 261, in query
    _mysql.connection.query(self, query)
django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'address' used in key specification without a key length")