Skip to main content

A port of presskit() to Django

Project description

django-presskit

A port of Rami Ismail's presskit()/dopresskit to Django.

Build Status Coverage Status

Installing

Requirements:

  • Django>=2.2
  • django-filer>=2.0.2
  • easy_thumbnails>=2.7.1
  • Markdown>=2.6.11
  • Pillow>=7.1.0
  • django-admin-sortable2>=0.7.7
  • future>=0.18.2

Configuring

Add "django_presskit" and "adminsortable2" to your settings.py INSTALLED_APPS.

Add DJANGO_PRESSKIT_DEFAULT_COMPANY_ID = 1 to your settings file.

In your main urls.py, add a line like: url(r'^presskit/', include('django_presskit.urls', namespace='django_presskit')),

All data can be set up in the Django admin.

Upgrading

If upgrading to 1.1.0, run the following on your project after adding adminsortable2 to your settings:

python manage.py reorder django_presskit.additionallink django_presskit.award django_presskit.companyimageattachment django_presskit.companylogoattachment django_presskit.companyvideo django_presskit.contact django_presskit.credit django_presskit.feature django_presskit.platform django_presskit.price django_presskit.project django_presskit.projectimageattachment django_presskit.projectlogoattachment django_presskit.quote django_presskit.social django_presskit.trailer

Converting from presskit()/dopresskit

If you are switching from Rami Ismail's presskit(), you'll want to make sure any old URLs that are floating around continue to work. Presskit() URLs look like /presskit/sheet.php?p=exploit_zero_day. You'll want to convert those into something like /presskit/exploit-zero-day/.

Make sure that the slugs for your django-presskit projects match those for your presskit() projects. Then, you can use URL rewriting to redirect users to the new URL.

If you have Apache with mod_rewrite enabled, add something like the following to your .htaccess file:

RewriteEngine  on
RewriteCond %{QUERY_STRING} ^p=(.*)$
RewriteRule "^/?presskit/sheet.php"  "/presskit/projects/%1" [N]
# Repeatedly remove underscores until only one is left.
RewriteRule "^(/?presskit/projects/.*)_(.*_.*)$"  "$1-$2" [N]
# Redirect with the last underscore rewrite.
RewriteRule "^(/?presskit/projects/.*)_(.*)$"  "$1-$2" [R=301]
RewriteRule "^/?presskit/sheet\.php$ "              "/presskit/" [R=301]

If you're using nginx for rewrites, this would look like:

location ~* /presskit/sheet.php {
    if ($args ~* "^p=(\d+)") {
        set $proj $1;
        set $args '';
        rewrite ^.*$ /presskit/projects/$proj permanent;
    }
}
# Remove up to 10 underscores until none are left.
rewrite ^(/?presskit/projects/.*?)_(.*)$  $1-$2 last
rewrite ^/?presskit/sheet\.php$           /presskit/ permanent

If you're using nginx and one of your slugs has more than ten underscores, add a rewrite above the first one to manually fix that one case. Nginx does not want to loop more than 10 times in a rewrite calculation.

Changelog

1.3.1

  • Upgrade packages

1.3.0

  • Add support for Django 2 and 3, drop support for Django 1

1.2.0

  • Upgrade to support Python 3.6+
  • Bump to Pillow 6.2.0
  • Bump to Django 1.11.23

Contributing

When submitting issues or pull requests, please adhere to our Code of Conduct.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_presskit-1.3.1.tar.gz (30.6 kB view details)

Uploaded Source

Built Distribution

django_presskit-1.3.1-py3-none-any.whl (38.9 kB view details)

Uploaded Python 3

File details

Details for the file django_presskit-1.3.1.tar.gz.

File metadata

  • Download URL: django_presskit-1.3.1.tar.gz
  • Upload date:
  • Size: 30.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.3 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.7.3

File hashes

Hashes for django_presskit-1.3.1.tar.gz
Algorithm Hash digest
SHA256 566607eecaf26253223660bda5111d0da368fc3805e74cd15ce0a22e669e39ff
MD5 e97e4acf34991ef9c477c9b72cd0fcda
BLAKE2b-256 2d79e57c4539c6f84eeb0930778fe5c16c7459c9b6e52ac6f78e3deb7699f3cc

See more details on using hashes here.

File details

Details for the file django_presskit-1.3.1-py3-none-any.whl.

File metadata

  • Download URL: django_presskit-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 38.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.3 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.7.3

File hashes

Hashes for django_presskit-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2421239a1155bcac987f9c3395e4dbcfa374449888d33f0c74ed0e47c8ec6bcc
MD5 e13c9647c3d8499419bfcaf5891af226
BLAKE2b-256 5022d705d7d9fdd4b260e1c7d2e4efe4b8c36ed53a273f86aca40ee2b98aad6a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page