小编Aid*_*ell的帖子

django 错误无法导入名称 'RemovedInDjango30Warning'

伙计们,我对 Django 还很陌生,我刚刚开始从事一个个人项目,并决定使用不当的 pycharm(我认为它与错误有关,或者是否与错误有关)。

当我运行时,python manage.py runserver我收到下面发布的错误。我做了一些谷歌搜索,看起来是由于与 Django 版本不一致造成的。

我目前有 Django 3.0,我在全局和 venv 中都进行了检查。

我试图在 py 魅力之外启动一个项目,但我遇到了同样的问题。知道我需要做什么才能再次开始使用 Django。有没有人遇到过这个?这是因为pycharm吗?如果是这样,我能做些什么来解决这个问题?

(venv) aiden@aiden-XPS-15-9570:~/PycharmProjects/NewsAggregator$ python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/home/aiden/.local/lib/python3.6/site-packages/django/template/utils.py", line 66, in __getitem__
    return self._engines[alias]
KeyError: 'django'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/aiden/.local/lib/python3.6/site-packages/django/template/backends/django.py", line 121, in get_package_libraries
    module = import_module(entry[1])
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, …
Run Code Online (Sandbox Code Playgroud)

django pycharm python-3.x

12
推荐指数
2
解决办法
1万
查看次数

我们使用preventDefault方法时有用吗?

我们使用preventDefault方法时有用吗?(在函数的开头和结尾处).我看过的所有教程都在函数结尾处放置了preventDefault,但我认为你要做的第一件事是阻止默认行为.我注意到它可以工作,如果它在函数的开头,它在函数的最后工作:

function calculateResults(e){

    e.preventDefault();
    //UI Vars
    const amount = document.querySelector(`#amount`);
    const interest = document.querySelector(`#interest`);
    const years = document.querySelector(`#years`);
    const monthlyPayment = document.querySelector(`#monthly-payment`);
    const totalPayment = document.querySelector(`#total-payment`);
    const totalInterest =document.querySelector(`#total-interest`);

    const princapal =  parseFloat(amount.value);
    const calculatedInterest = parseFloat(interest.value)/100/12;
    const calculatedPayment = parseFloat(years.value) * 12;

    // compute monthly payments
    const x = Math.pow(1 + calculatedInterest, calculatedPayment);

}
Run Code Online (Sandbox Code Playgroud)

VS

function calculateResults(e){

    //UI Vars
    const amount = document.querySelector(`#amount`);
    const interest = document.querySelector(`#interest`);
    const years = document.querySelector(`#years`);
    const monthlyPayment = document.querySelector(`#monthly-payment`);
    const totalPayment = document.querySelector(`#total-payment`); …
Run Code Online (Sandbox Code Playgroud)

javascript methods preventdefault

2
推荐指数
1
解决办法
40
查看次数