django에 mysql을 사용하려고 했으나 연결이 어려웠다. 아래 방법들을 다 시도해보고 결국 export PATH=$PATH:/usr/local/mysql/bin/ 를 통해 mysql config위치를 다시 정해 주고 pymysql을 설치하고 django downgrade로 문제 해결 했다.

pymysql 설치 https://stackoverflow.com/a/56312295

django downgrade https://stackoverflow.com/a/58448370

최종적으로 사용된 modules

image
image

.

.

.

image

.

.

.

image

.

.

.

image

위와 같은 error 발생

.

.

ModuleNotFoundError: No module named ‘MySQLdb’

https://stackoverflow.com/questions/53024891/modulenotfounderror-no-module-named-mysqldb

unable to install mysqlclient in python 3.7.3
https://stackoverflow.com/questions/57808191/unable-to-install-mysqlclient-in-python-3-7-3

What’s the difference between MySQLdb, mysqlclient and MySQL connector/Python?

https://stackoverflow.com/questions/43102442/whats-the-difference-between-mysqldb-mysqlclient-and-mysql-connector-python/46396881#46396881

pip install mysql-python fails with EnvironmentError: mysql_config not found
https://stackoverflow.com/questions/5178292/pip-install-mysql-python-fails-with-environmenterror-mysql-config-not-found

Import error :No module named MYSQLdb

https://askubuntu.com/questions/583415/import-error-no-module-named-mysqldb/1048285#1048285

Django – installing mysqlclient error: mysqlclient 1.3.13 or newer is required; you have 0.9.3

https://stackoverflow.com/questions/55657752/django-installing-mysqlclient-error-mysqlclient-1-3-13-or-newer-is-required

This Activity already has an action bar supplied by the window decor

How to avoid Force Close Error in Android

# importing exception_nibie
from exceptions_nibie import NibieException


def dev_nibie_test(request):
    data={}
    
    try:
        raise NibieException({"message":"My hovercraft is full of animals", "animal":"eels"})
    
    except NibieException as e:
        details = e.args[0]
        print(details["message"])
        print(details["animal"])

exceptions_nibie 모듈화일 안의 custom NibieException 클래스를 import하고 이를 사용하는 예시를 보여준다.

# importing exception_nibie
from exceptions_nibie import NibieException


def dev_nibie_test(request):
    data={}
    
    try:
        raise NibieException({"message":"My hovercraft is full of animals", "animal":"eels"})
    
    except NibieException as e:
        details = e.args[0]
        print(details["message"])
        print(details["animal"])

exceptions_nibie 모듈화일 안의 custom NibieException 클래스를 import하고 이를 사용하는 예시를 보여준다.

Proper way to declare custom exceptions in modern Python?

You are pretty much right on. Except for one thing I’ll mention in a bit.throws is as much a part of the method API as the name and the parameters. Clients know if they call that method, they need to handle that exception–by simply throwing it also or by catching it and handling it (which may in fact entail the throwing of another exception wrapping the original). throws is addressed at compile time.throw is the actual act of letting the runtime know something bad happened–that the exceptional condition we were worried about has in fact taken place. So it needs to be dealt with at runtime.But you weren’t quite right when you said, “Throws in method signature should always appear if there exist a throw statement in the method.” That is often true but not always. I could also call another method that throws an exception within my method, and if I don’t catch it, my method needs to throw it. In that case, there is no explicit throw of the same exception by me.The final point is that you only need to declare an exception in throws when the exception is a checked exception–meaning it is from the other side of the Exception class hierarchy from RuntimeException. Common checked exceptions are IOException and SQLException. Checked exceptions must be listed in the throws part of the method signature if you don’t handle them yourself. Anything subclassing RuntimeException–like NoSuchElementException in your example and also the hated NullPointerException–is an unchecked exception and doesn’t have to be caught or thrown or anything.Typically, you use checked exceptions for recoverable problems (where the client knows what can happen and can gracefully handle the problem and move on) and unchecked exceptions for catastrophic problems (like can’t connect to the database).If you can get past all the AOP stuff, this is a great discussion of how you use checked and unchecked exceptions effectively.

Java has two different types of exceptions: checked Exceptions and unchecked Exceptions.

Unchecked exceptions are subclasses of RuntimeException and you don’t have to add a throws declaration. All other exceptions have to be handled in the method body, either with a try/catch statement or with a throws declaration.

Example for unchecked exceptions: IllegalArgumentException that is used sometimes to notify, that a method has been called with illegal arguments. No throws needed.

Example for checked exceptions: IOException that some methods from the java.io package might throw. Either use a try/catch or add throws IOException to the method declaration and delegate exception handling to the method caller.