🎉 سال نو، مهارت نو، مشاوره رایگان نقشه راه برنامه نویسی (آفر ویژه ثبت نام قبل از افزایش قیمت 🔥)
۰ ثانیه
۰ دقیقه
۰ ساعت
۲ سید محمد جواد فاطمی
add static file
جامعه پایتون (وب) ایجاد شده در ۰۶ مرداد ۱۴۰۲

salam vaghti project ra run migiram file haye css namayesh dade nemishavad, yani faghat html kar tu browser miayad.

setting.py

"""
Django settings for academy project.
Generated by 'django-admin startproject' using Django 3.2.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
import os
from pathlib import Path
from academy.local_settings import *
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
# SECURITY WARNING: don't run with debug turned on in production!
ALLOWED_HOSTS = ["*"]
# Application definition
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'finance.apps.FinanceConfig',
]
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 = 'academy.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 = 'academy.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': DB_NAME,
        'PASSWORD': DB_PASS,
        'HOST': DB_HOST,
        'USER': DB_USER,
        'PORT': DB_PORT,
    }
}
# Password validation
# https://docs.djangoproject.com/en/3.2/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.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Asia/Tehran'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.2/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
# MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
# MEDIA_URL = '/media/'
# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
LOGIN_URL = "/admin/login/"
ZARRINPAL = {
    'gateway_request_url': 'https://sandbox.zarinpal.com/pg/services/WebGate/wsdl',
    'gateway_callback_url': 'http://0.0.0.0:8000/finance/verify',
    'merchant_id': ZARRINPAL_MERCHANT_ID
}

html:

{% load static %}
html>
<html lang="en">
<head><meta charset="UTF-8"><title>Titletitle>
    <link rel="stylesheet" href="{% static 'package/css/pricing.css' %}">
head>
<body><div class="services"><section class="pricecol"><div class="icon"><i class="icon-magic">i>
    div>
    <h3><Span>Web Designspan>h3>
    <ul>S
    <li>Etiam sit amet orcili>
    <li>Duis leo sed fringillali>
    <li>Mauris sit amet nibhli>
    <li>Donec sodales sagittisli>
    ul>
    <p><a class="button"><span>Sign Upspan>a>
    p>
    section>
    <section class="pricecol"><div class="icon"><i class="icon-leaf">i>
    div>
    <h3><Span>Developmentspan>h3>
    <ul><li>Etiam sit amet orcili>
    <li>Duis leo sed fringillali>
    <li>Mauris sit amet nibhli>
    <li>Donec sodales sagittisli>
    ul>
    <p><a class="button"><span>Sign Upspan>a>
    p>
    section>
    <section class="pricecol"><div class="icon"><i class="icon-link">i>
    div>
    <h3><Span>Supportspan>h3>
    <ul><li>Etiam sit amet orcili>
    <li>Duis leo sed fringillali>
    <li>Mauris sit amet nibhli>
    <li>Donec sodales sagittisli>
    ul>
    <p><a class="button"><span>Sign Upspan>a>
    p>
    section>
    div>
body>
html>

css:

.services
{
width:1000px;
overflow:auto;
margin:0 auto;
}
.pricecol
{
width:31%;
background:rgb(38, 48, 52);
min-height:30%;
border-radius:10px;
position:relative;
padding:30px 0px;
text-align:center;
font-family:verdana;
float:left;
margin-left:20px;
}
.icon
{
width:60px;
height:60px;
border-radius:100%;
background:rgb(108, 140, 54);
color:#fff;
text-align:center;
position:relative;
margin:0 auto;
}
.icon i
{
font-size:30px;
position:relative;
top:15px;
}
h3
{
text-align:center;
background:rgb(34, 43, 47);
text-align:center;
border-top:1px solid rgb(25, 31, 34);
border-bottom:1px solid rgb(51, 60, 64);
color:#fff;
}
h3 span
{
border-top:1px solid rgb(51, 60, 64);
border-bottom:1px solid  rgb(25, 31, 34);
display:block;
padding: 10px 0px;
font-family:verdana;
font-size:20px;
}
.button
{
border-radius:34px;
border:5px solid rgba(255, 255, 255, 0.07);
color:rgb(64, 85, 29);
font-size:16px;
margin-top:15px;
text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.15);
cursor:pointer;
display:inline-block;
}
.button span
{
display:inline-block;
padding:10px 15px;
background: none repeat scroll 0% 0% rgb(108, 140, 54);
border-radius:20px;
box-shadow: 0px 0px 1px rgba(255, 255, 255, 0.3) inset, 0px 2px 0px rgba(255, 255, 255,
0.1) inset;
}
ul
{
list-style-type:none;
padding:0px;
color:#fff;
font-family:verdana;
font-size:14px;
margin:0 auto;
text-align:center;
width:70%;
color:rgb(165, 174, 178);
border-bottom:1px solid rgb(51, 60, 64);
border-top:1px solid rgb(25, 31, 34);
}
li
{
padding:10px 0px;
border-top:1px solid rgb(51, 60, 64);
border-bottom:1px solid rgb(25, 31, 34);
}

name project=academy - > app=package, static, package, css, pricing.css

templates -> package, pricing.html

hame chiz dorost hast hata didam tu jalase i ke dar mored file haye static tadris shode bood yeki az mentor ha gofte bood momkene django 3.2 nabashe vali pip freeze ke zadam 3.2 bood

darost shod app jadid ra tu INSTALLED_APPS ezafe nakarde boodam :)

سید محمد جواد فاطمی ۰۷ مرداد ۱۴۰۲، ۰۸:۰۸

سلام خوشحالم مشکلتون حل شده

موفق باشید

بهترین پاسخ
پوریا شفیعی ۰۷ مرداد ۱۴۰۲، ۱۳:۲۳