Skip to content

Instantly share code, notes, and snippets.

@Shrestha7
Created October 18, 2021 08:58
Show Gist options
  • Save Shrestha7/889e1e3d8c0714fc0b72d05cf7a454b8 to your computer and use it in GitHub Desktop.
Save Shrestha7/889e1e3d8c0714fc0b72d05cf7a454b8 to your computer and use it in GitHub Desktop.
listing the path of directory templates
from pathlib import Path
from typing import Reversible
from django.db import models
from os import listdir
from os.path import isfile, join
import os
# Create your models here.
class insp(models.Model):
xml =models.FileField(upload_to='xml/')
print (os.path.abspath(__file__))
print (Path().resolve().parent)
onlyfiles = [f for f in listdir(str('E:/Projects/demodj/alpha/templates/xml/'))]
print(onlyfiles)
@Shrestha7
Copy link
Author

listing templates from dir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment