RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-373227

Develop's questions

Martin Hope
Develop
Asked: 2020-07-14 09:14:17 +0000 UTC

如何正确转储 PostgreSQL 数据库?

  • 0

我在 nginx 和 gunicorn 上有一个工作的 Django 站点,转储数据库的正确方法是什么?我是否需要禁用nginx,我只是尝试转储错误,无法连接到服务器:

pg_dump: [archiver (db)] connection to database "mydb" failed: could not connect to server: Connection refused
    Is the server running on host "0.0.0.0" and accepting
    TCP/IP connections on port 5432?

而不是 0.0.0.0 我的 ip。怎么做才对?提前致谢!

sql
  • 1 个回答
  • 10 Views
Martin Hope
Develop
Asked: 2020-07-09 23:54:53 +0000 UTC

为什么在ajax之后点击不起作用?

  • 1

我使用 ajax 获取数据并将其插入到 div 中,但单击这些块不再有效。如何解决这个问题?

 $('body').find('select').css({ 'display': 'none' });
        $('body').find('label').css({ 'display': 'none' });
        $(".add_to_cart").submit(function (e, addr) {
            e.preventDefault();
            var quantity = $(this).find('select option:selected').val();
            console.log(quantity);
            $.ajax({
                type: "POST",
                url: String($(this).data("action")),
                data: { csrfmiddlewaretoken: csrftoken, quantity: quantity },
                success: function (data) {
                    console.log(data);
                    $('.main-offer_list').html(data);
                    
                }
            });
        });
        $( ".delete-btn" ).on( "click", function(e){ 
            e.preventDefault();
            $.ajax({
                type: "POST",
                url: String($(this).data("delete")),
                data: { csrfmiddlewaretoken: csrftoken },
                success: function (data) {
                    $('.main-offer_list').html(data);
                }
            });
      });
javascript
  • 1 个回答
  • 10 Views
Martin Hope
Develop
Asked: 2020-07-05 22:39:05 +0000 UTC

Django路径导航不起作用

  • 0

设置.py

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

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',
]

ROOT_URLCONF = 'redpandasushi.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            os.path.join(BASE_DIR, 'templates'),
        ],
        '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',
            ],
        },
    },
]

WSGI_APPLICATION = 'redpandasushi.wsgi.application'


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

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}


# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/

LANGUAGE_CODE = 'ru-Ru'

TIME_ZONE = 'Europe/Kiev'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/

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

urls.py 主要

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('shop/', include('shop.urls')),
]

urls.py 商店

from django.urls import path, include
from . import views

urlpatterns=[
    path('',views.index, name="index")
]

视图.py

from django.shortcuts import render, HttpResponse

# Create your views here.

def index(request):
    return render(request, 'polls/index.html')

index.html 文件位于 shop/templates/polls/index.html 文件夹中,出现 TemplateDoesNotExist at /shop/ 错误。告诉我如何解决?

python
  • 1 个回答
  • 10 Views
Martin Hope
Develop
Asked: 2020-06-09 02:39:42 +0000 UTC

为什么 .click 在第二个按钮上不起作用?

  • 1

我有几个按钮,单击时应该会弹出一个模式窗口,但是当您单击具有给定 id 的第一个按钮时,一切正常,但第二个没有。我究竟做错了什么?

$( document ).ready(function() {
        $("#modalBtn").click(function() {
            $("#myModal").css({'display':'block','z-index':'10000000000000'});
         });
         $('.close').click(function(){
            $("#myModal").css({'display':'none','z-index':'10000000000000'});
         });

html代码:

<div class="more"><a id="modalBtn"><span class="align-elem">Уточнить стоимость</span></a></div>
<a id="modalBtn"><span class="align-elem">Рассчитать стоимость</span></a>
jquery
  • 1 个回答
  • 10 Views
Martin Hope
Develop
Asked: 2020-05-22 02:56:45 +0000 UTC

如何正确设置输入的值?

  • 1

我正在尝试为输入设置一个值,但该值没有被写入,尽管消息变量中有文本,我该如何解决这个问题?

$( document ).ready(function() {
    var message = "";
    $( ".class" ).click(function() {
        $('.class1.class2.class3').each(function(){
            message+=$(this).html()+';';
        });

    });
    $("input[name='all_prod']").val('1'+String(message)+'1');
});   
jquery
  • 1 个回答
  • 10 Views
Martin Hope
Develop
Asked: 2020-05-21 20:35:50 +0000 UTC

如何获取注册表中的值?

  • 0

如何获取当前windows 10系统语言的代码,试过这个

from winreg import *

aReg = ConnectRegistry(None,HKEY_LOCAL_MACHINE)
aKey = OpenKey(aReg, r"SYSTEM\CurrentControlSet\Control\Nls\Language")
for i in range(1024):
    try:
        keyname = EnumKey(aKey, i)
        asubkey = OpenKey(aKey, keyname)
        val = QueryValueEx(asubkey, "DisplayName")
        print(val)
    except WindowsError:
        break

一些错误,虽然如果你沿着 SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall 路径搜索,它会在注册表中显示一个值。我尝试输入 InstallLanguage 而不是 DisplayName,但没有帮助。

python
  • 1 个回答
  • 10 Views
Martin Hope
Develop
Asked: 2020-03-25 08:27:37 +0000 UTC

如何在没有 fn 的情况下删除按钮的工作?

  • 1

在我的笔记本电脑上,f1 f2 f3 键等,还有切换到睡眠模式、关闭wi-fi等的附加功能,但是只要你按下按钮它们就可以工作,而按钮本身只与fn一起工作,但它应该是相反的方式,如何解决它?

windows
  • 1 个回答
  • 10 Views
Martin Hope
Develop
Asked: 2020-02-28 23:24:05 +0000 UTC

如何按标准展示产品?

  • 0

如何在 WooCommerce 中显示产品名称,例如字母“b”。这可以在没有插件的情况下完成吗?

wordpress
  • 1 个回答
  • 10 Views
Martin Hope
Develop
Asked: 2020-02-25 21:26:09 +0000 UTC

如何用一个类遍历所有元素并计算它们的总和?

  • 0

我正在尝试用价格类计算 div 中所有文本的总和,我该怎么做?以及如何从 div 中删除空格和多余的文本?

<div class="price">100руб</div>
<div class="price">100руб</div>
<script>
    var price=0;
    $('.price').each( function(i) {
        price += Number($(this).textContent);
        document.write(price);
    });
 </script>
javascript
  • 2 个回答
  • 10 Views
Martin Hope
Develop
Asked: 2020-02-21 21:15:00 +0000 UTC

如何在所有产品的页面上将产品添加到购物车?

  • 1

如何在自定义页面上将产品添加到购物车?简码不起作用,我的代码也不起作用?我知道这需要通过 Ajax 请求来完成,但我不太明白如何,请告诉我

        while ( $loop->have_posts() ): $loop->the_post(); ?>
        <div class="product-main">
            <div class="product-img"> <a href="<?php echo get_permalink(); ?>" class="avatar"><img class="responsive-img" src="<?php
            $thumb_id = get_post_thumbnail_id();
            $thumb_url = wp_get_attachment_image_src($thumb_id,'thumbnail-size', true);
            echo $thumb_url[0];
            ?>" alt=""></a>
            <div class="product-title"><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></div>
            <div class="product-size">Размер: <?php echo $product->get_attribute('size'); ?> см.</div>
            <div class="product-price__box">
                <div class="product-price">Цена: <?php echo $product->get_price_html(); ?> грн.</div>
                <div class="info-cart"><a href="<?php echo esc_html( $product->single_add_to_cart_text() ); ?>"><img src="/wp-content/themes/dropship/assets/img/cart.png"></a></div>
            </div>
            <div class="product-button">
                <button class="fast-buy">Быстрая покупка</button>
            </div>
            </div>
        </div>
        <?php endwhile; ?>

我稍微修改了我的代码,现在货物被添加了但是是几件,如何解决这个问题?

<?php
 global $post, $woocommerce;
?>

    <div class="products-main">
        <?php  $loop = new WP_Query( array(
        'post_type' => 'product',  // указываем, что выводить нужно именно товары
        'posts_per_page' => 12, // количество товаров для отображения
        'orderby' => 'date', // тип сортировки (в данном случае по дате)
        'product_cat' => $sort,
        )); 



        while ( $loop->have_posts() ): $loop->the_post(); ?>
        <div class="product-main">
            <div class="product-img"> <a href="<?php echo get_permalink(); ?>" class="avatar"><img class="responsive-img" src="<?php
            $thumb_id = get_post_thumbnail_id();
            $thumb_url = wp_get_attachment_image_src($thumb_id,'thumbnail-size', true);
            echo $thumb_url[0];
            ?>" alt=""></a>
            <div class="product-title"><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></div>
            <div class="product-size">Размер: <?php echo $product->get_attribute('size'); ?> см.</div>
            <div class="product-price__box">
                <div class="product-price">Цена: <?php echo $product->get_price_html(); ?> грн.</div>
                <div class="info-cart"><a href="<?php $woocommerce->cart->add_to_cart( $thumb_id-1,1 ); ?>"><img src="/wp-content/themes/dropship/assets/img/cart.png"></a></div>
            </div>
            <div class="product-button">
                <button class="fast-buy">Быстрая покупка</button>
            </div>
            </div>
        </div>
        <?php endwhile; ?>
wordpress
  • 1 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5