Skip to content

ErrorGuide

N KRISHNA RAJ edited this page Jul 28, 2021 · 3 revisions

Developer Guide to Handle Errors

As a Developer and a Maintainer of OSCHub, I tried to compile as much as information that will be helpful for you, the Future maintainers and Developers of the OSCHub project. This guide will contain the errors that we overcame, fixes to some specific errors and more.

Contact the Maintainers or Developers of the project if necessary for further clarifications.

While making a new database, OperationalError: No Such Table …

This error occurs when the table is not available in your database and some program scripts wants to access the table in the database to proceed further.

Fix:

  • Comment out all the scripts that use this specific table. (Eg: Commenting out SheetMe.py, admin.py [from all the django applications])
  • Delete the database file (would recommend to do so as this error only occurs when you create a new database)
  • Run python manage.py migrate : this will create the database and converts the changes to sqlite commands.
  • Run python manage.py makemigrations: this will update any latest changes and updates the database with the sqlite commands.
  • Uncomment all the scripts which you had previously commented out.

Cannot create SuperUser account, Operational Error: …

This error occurs as you are trying to add a new entry to the Database file but you cannot do that as some of the scripts in the project needs the database to process some things.

Fix:

  • Comment out all the scripts that use the database. (Eg: SheetMe.py, admin.py[from all django applications], PopulateMe.py, etc..)
  • Run python manage.py createsuperuser: this will notify django shell that you want to create a superaccount and lets you create a new one.
  • Follow the steps, Enter your desired or preferred username and password.
  • Uncomment all the scripts that you had previously commented out.

Accidental deletion of the files inside Migration folder in all the Django Applications

Sometimes we developers don’t feel the need to keep the initial migration files of the database when we use the project for production purposes but in the future when you want to update somethings to your database, you end up with an issue where your Database doesn’t contain the tables which are there in django applications such as Accounts, Dashboard and Eventreg. To fix this we simply need to make new migration files so the next time you make the database again, all the migration files will be read and all the tables will be formed within the new database.

Fix:

  • I would recommend to comment out all the scripts that use database to prevent errors.
  • Run python manage.py migrate --fake: Reset all the migrations of the Django's built-in apps like admin with the command
  • Run python manage.py makemigrations <appname>: Created migration file for the mentioned application name.

Feedback form: SMTP Bad Credentials Error

You get this error often for not checking the email-id and password of the bot or service account. So make sure that all the user details are correct.

Fix:

  • Check the email-id and the password of the bot account.
  • Turn ON Allow Less Secure Apps in OSCHub bot email, Google tends to Turn it Off automatically sometimes.

Feedback form: SMTP Authentication Error

This error can occur for various reasons. It was really hard to fix this one, but following are the options that might fix this issue. For more options, you can checkout this link

Fix:

  • Turn ON Allow Less Secure Apps in OSCHub bot email, Google tends to Turn it Off automatically sometimes.
  • Really I've got not clue on how this works, but the config variables in the settings.py should be in the following order.
    EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
    EMAIL_USE_TLS = True
    EMAIL_HOST = 'smtp.gmail.com'
    EMAIL_HOST_USER = 'xxxx@gmail.com'
    EMAIL_HOST_PASSWORD = 'xxxxxxxx'
    EMAIL_PORT = 587
  • Last but not least, Unlocking DisplayCaptcha solves the error, head over to the link and login with the bot account to enable the option.