Random tarot card generator + rudimentary Django CMS

Related tags

CMS python django
Overview

TAROT JUICER

:godmode:

Magick

This is a rudimentary Django-based CMS which dynamically presents tarot-related content placed onto unconventional but familiar contexts such as hollywood film and historical biography. Our purpose is to overturn and reform the audience's perspective beyond all recognition. The author endeavours to reach out (or "appeal") to the broadest audience possible.

DJANGO APPS

Here are Django apps I've created and what their purpose is:

  • generators: When a web user clicks the 'random' button, it serves one of twenty two tarot keys arbitrarily. Each tarot card webpage includes:

    • A picture of the tarot key
    • The name of the key
    • Astrological Attribute
    • Alchemical Attribute
    • Intelligence
    • Hebrew Letter
    • Letter Meaning
    • Description of the symbolic meaning
    • The description applied to:
      • Galileo
      • FLOSS
      • St Paul the Apostle

    This app houses the most dynamic functionality of my whole website

  • landings: Serves the landing/home page (the portal.html template) showing the extraordinary 'global initiation' message. This app also serves the 'about' template which is a webpage which explains the basic who, what, when, why (or purpose) of the website in general (similar to the preface to a book)

  • essays: Serves the article.html template which captures a curated list of the most high impact tarot cards and their application to Galileo and FLOSS (bound together simultaneously) along with a curated list of tart cards applied to St. Paul. This essays app also serves up static articles (without dynamic functionality) similar to a blog post - - for essays by the author on tarot applied to Forrest Gump and the war of ideas. This essays app even includes an 'objections' page for content involving anticipated rebuttals from my various audiences. This essays app also refers to a basic content_changelog.html template which enables the author to document changes made to essays or other content over time.

  • accounts: This feature gives website visitors who land on the 'gateway' landing page to enter a passphrase to gain access the rest of the site.

BUILD INSTRUCTIONS

For *nix:

$ virtualenv --python=python3.9 venv
$ source venv/bin/activate
$ pip install -r requirements.txt
$ python manage.py runserver

You will also need to install postgresql v12.3. On Manjaro/Arch, you may use this:

$ sudo pacman -S postgresql postgresql-libs

USAGE NOTES

#1. Swapping lorem ipsum db out with real prod db content

The official Heroku docs cover provisioning Postgres, designating a primary database, sharing Postgres db's between applications, and more. This doc explains how to juggle/change/swap out one db instance for another.

#2. Postgres and cultivating an archive of backups

This note to self I moved into it's own (private - hidden) gist titled Guide to backing up Postgres on Friday 9 April 2021. More work needs to be done. My next step will involve either (a) learning AWS S3 or (b) writing a custom Python script using multiple symlinks to automate the download of Postgres instances and mirror them up to my Digital Ocean droplet.

#3. Handling db remote instances but locally

It's possible to run a remote AWS Postgres db locally. It's as straightforward as running:

(local venv) $ export DATABASE_URL='postgres://USER:PASSWORD@HOST:PORT/NAME'

whose DATABASE_URL you can source from the Heroku Dashboard. If you are havinng trouble determining the right 'colored' DB you can use:

(local venv) $ heroku addons --app tarot-prod

You can also use:

(local venv) $ heroku pg:info --app tarot-prod

These commands should reveal the name of the add-on to distinguish the db with 'lorem' content from the db with 'real' content.

It's also very important to note that when exporting a db locally, you need to do it inside the same terminal that the local dev server is running in. For this to work, you'll need to exit the currnet local dev server, unset the existing db, export the db, and then finally run the server again.

You can view the current db configuration (probably db.sqlite3 default) with:

(local venv) $ echo $DATABASE_URL

To remove or backout from using a remote Postgres instance and reintroduce db.sqlite3, this is the command you need:

(local venv) $ unset DATABASE_URL

PLEASE NOTE and to emphasize once more: It's important that you handle all of the above commands in the same terminal emulator. If you run export $DATABASE_URL in one terminal, and then have the server running in a different terminal, it won't work. Use all of the above commands in the same terminal that you are running the local server in.

#4. Config variables

In the Heroku Dashboard, here are some of the variables you need to change for it to work in the production enviornment:

  • DJANGO_DEBUG : This config variable in production needs to be set to False to run the app, this will also resolve the check deploy issues
  • ALLOWED_HOSTS : Set its value by adding multiple hosts as ( separating each host by a space) host1 host2 host3
  • ADMIN_PATH : Set its value to make the admin path as secure as you prefer the best.
  • HEROKU_POSTGRESQL_ _URL : postgres://USER:PASSWORD@HOST:PORT/NAME you can reset the PASSWORD variable on the fly by using:
    (local venv) $ heroku pg:credentials:rotate
    
    If you compare the postgres://USER:PASSWORD@HOST:PORT/NAME in the Heroku dashboard before and after redunning the Heroku 'rotate' command, most of the variables remain the same however the USER and PASSWORD will be different. This protects keys that I may have previously referred to publiclly in the Issues section of this repo. More details can be gleaned from this Heroku help doc titled, How do I make sure my Heroku Postgres database credentials are correct? which I found by Googling: 'how to update postgresql credentials in heroku'.

#5. Resolving empty thumbnails (tarot card album) static files

If you accidentally upload duplicate tumbnails (generator app), Django will append a small hash to the .jpg and it won't parse when Django serves the tarot_key template. It's kind of a bug. The problem should only happen remotely on Heroku. If that happens (and it doesn't happen all the time), then the recourse is to use this command on Heroku: (local venv) $ heroku run python manage.py collectstatic -a tarot-testing --noinput --clear --no-post-process. Be sure to specify the right app (whether tarot-testing or tarot-prod). That will purge all static files with hashes. I don't completely understand why, but UmarGit and I went back forth on Upwork on June 14th, 2021.

This was an issue (#92) resolved on 9 April 2021 but which became an issue again on 14 May.

There seems to be three staticfiles directories declared inside settings.py. The one inside tarot_juicer/tarot_juicer/static is for development locally. The directroy tarot_juicer/staticfiles houses the static files on Heroku which will be intialized and created with the pgbounce buildpack in the cloud - - so there is no need for this directory locally. I'm not sure what tarot_juicer/static is for.

#6. heroku-cli x2

There are two heroku-cli app interfaces. The first heroku-cli app is installed locally for interacting between the local development environment and the remote server. The second heroku-cli app is installed remotely for interacting with itself. To install, you just navigate in Heroku settings for the app and click: “Add buildpack” and enter: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku-community/cli.tgz. Next go to Manage Account (settings - - top right corner of avatar icon). Then scroll down and select: “Regenerate API Key”. Next time you push changes and Heroku rebuilds everything, then heroku-cli should be installed. For future reference, you may use the official Heroku doc for managing authentication and API token storage.

TO DO:

  • There are 5 ways to make my Django project more secure. https://hackernoon.com/5-ways-to-make-django-admin-safer-eb7753698ac8
    • One of them is to: "Visual disntinguish environemnts". It's a great suggestion by color coding the Django admin panel. I should implement a color coded banner at the top of every web page when the Django Admin user is logged in but the "Nuclear" option (in accounts app) is toggled on blocking all other web vistors out because right now, if the Nuclear option is triggered, the the 'logout' link on the /portal page appears but clicking on it does nothing. This is because the ADmin User has access. To help elinate confusion, there should be a colour coded banner at the top of /portal and all the other pages on the website whent he Admin user is browsing and the Nuclear option is toggled.
  • Use this guide to populate my README.md with 'badges': https://github.com/Naereen/badges/blob/master/README.md
    • e.g, correc this:
    • See Google Chrome bookmarks named: "GitHub "Badges" readme rst md icons build passing RESEARCH" in April directory

PURPOSE

"In a world where men do battle over whose version of God is most accurate, I cannot adequately express the deep respect and admiration I feel toward an organization in which men of differing faiths are able to break bread together in a bond of comradery, brotherhood, and friendship," - - On Freemasonry courtesy of Dan Brown in a 2009 interview as quoted on page 48-49 in Mark E Koltko-Rivera's (2011) Freemasonry: An Introduction (London England: Penguin Group)

Comments
  • Importing Postgres backup to Heroku from AWS S3

    Importing Postgres backup to Heroku from AWS S3

    I’m learning how to handle Postgres instances by backing them up and restoring them on Heroku for a Django project (a small rudimentary CMS). The amount of data is a few hundred kilobytes because it's just text that I am storing in my my db. I'm practicing backups and restores just to learn for fun.

    I realize this is loosely related to Python/Django, but it does fall into the general category of development / programming. I hope my post is welcome here.

    I downloaded the binary data to my local machine using this particular section of the Heroku doc.

    The next step was to create an AWS account, including setting up Access Keys which I located in the dashboard and entered them into my local dev environment. I named my bucket. I uploaded the binary to S3.

    I’ve made it all the way to the end of Heroku’s import Postgres guide.

    I install the awscli package with pip which enabled me to presign my s3 bucket (which succeeded).

    I am right at the final step of importing my backup to Heroku Postgres. I am so close!

    My traceback at this point indicates that Heroku is expecting an HTTP 200 (request has succeeded) but instead it receives an HTTP 400 (can’t process) ‘due to the source URL being inaccessible’. This points towards the restrictive permissions in place on my AWS S3 bucket.

    You can find my traceback in full at the bottom issue.

    With regards to my AWS S3 bucket, in the dashboard, the main Permissions switch relevant here is the “Block all public access” option. Whether this checkbox is enabled or disabled (I carefully tried both), I encountered the same HTTP 200/400 in my traceback. This is where I believe the issue is.

    I’m not sure what else to try. I’m also a little concerned that with the vast number of variables available for Amazon’s S3 service, I don’t know how I might share or export my configuration nicely for you people to take a closer look. What other information could I provide to better help you people help me?

    Here is the restore command I am using:

    $ heroku pg:backups:restore 'https://postgres-restore-tarot-juicer.s3.amazonaws.com/2021June25_8801def6-27e0-4b88-875b-842be5704f0b?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAY6KWYZACZM3OX2O6%2F20210625%2FOhio%2Fs3%2Faws4_request&X-Amz-Date=20210625T111617Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=d56d7156537e03b7714c76e51f23eac9b08753a31b963818708d86cc77787f31' HEROKU_POSTGRESQL_SILVER --remote heroku --app tarot-prod --confirm tarot-prod

    
     ›   Warning: heroku update available from 7.50.0 to 7.54.1.
    Starting restore of https://postgres-restore-tarot-juicer.s3.amazonaws.com/2021June25_8801def6-27e0-4b88-875b-842be5704f0b\?X-Amz-Algorithm\=AWS4-HMAC-SHA256\&X-Amz-Credential\=AKIAY6KWYZACZM3OX2O6%2F20210625%2FOhio%2Fs3%2Faws4_request\&X-Amz-Date\=20210625T111617Z\&X-Amz-Expires\=3600\&X-Amz-SignedHeaders\=host\&X-Amz-Signature\=d56d7156537e03b7714c76e51f23eac9b08753a31b963818708d86cc77787f31 to postgresql-lorem-1... done
    
    Use Ctrl-C at any time to stop monitoring progress; the backup will continue restoring.
    Use heroku pg:backups to check progress.
    Stop a running restore with heroku pg:backups:cancel.
    
    Restoring... !
     ▸    An error occurred and the backup did not finish.
     ▸    
     ▸    waiting for restore to complete
     ▸    pg_restore finished with errors
     ▸    waiting for download to complete
     ▸    download finished with errors
     ▸    please check the source URL and ensure it is publicly accessible
     ▸    
     ▸    Run heroku pg:backups:info r039 for more details.
    

    Right at the end there, it recommends to use this info command:

    $ heroku pg:backups:info r038
     ›   Warning: heroku update available from 7.50.0 to 7.54.1.
     ›   Error: Multiple apps in git remotes
     ›     Usage: --remote staging
     ›        or: --app tarot-testing
     ›     Your local git repository has more than 1 app referenced in git remotes.
     ›     Because of this, we can't determine which app you want to run this command against.
     ›     Specify the app you want with --app or --remote.
     ›     Heroku remotes in repo:
     ›     tarot-prod (heroku)
     ›   tarot-testing (staging)
     ›
     ›     https://devcenter.heroku.com/articles/multiple-environments
    
    documentation 
    opened by enoren5 14
  • Abubakar

    Abubakar

    I just resolved issue #166 making all the apps' URLs protected dynamically. now, no one can breach your web's security by just adding a URL(of your apps that were not included in the protected URLs list) @enoren5 please review the new changes and let me know.

    opened by abubakarA-Dot 13
  • “Programming Error” with /admin/generator DB content when deployed on Heroku

    “Programming Error” with /admin/generator DB content when deployed on Heroku

    I’m experimenting with swapping different PostreSQL DB instances in and out on Heroku. I’ve got one instance for Lorem Ipsum content and the other instance for meaningful, quality blog content. The first DB was provisioned by a previous freelancer which works well. It is populated with placeholder content.

    Now I am trying to spawn a fresh DB from scratch and reconfigure. I’ve got it mostly set up but Django is throwing a Programming Error and I have no clue why. Here is the full error. Here is the main description of the error:

    ProgrammingError at /admin/generators/generator/ relation "generators_generator" does not exist LINE 1: SELECT COUNT(*) AS "__count" FROM "generators_generator"

    So far I’ve used Heroku’s official doc explaining how to set up a PostreSQL DB (specifically the provisioning section). I also read “Managing Add-ons”.

    To experiment with this new DB instance today, I also leveraged the console log provided by the previous freelancer for the prior Issue (#57). Here it is.

    Here are all the terminal commands I used in sequence in a pastebin. As you can see in there, I made a deliberate effort to migrate and make migrations (twice).

    What am I missing?

    edit: grammar correction

    opened by enoren5 13
  • Secure Heroku

    Secure Heroku

    Making Heroku Secure

    We need to setup some config vars as:

    • DJANGO_DEBUG : Set its value as False to run the app in production, this will also resolve the check deploy issues
    • ALLOWED_HOSTS : Set its value by adding multiple hosts as ( separating each host by a space )host1 host2 host3
    • ADMIN_PATH : Set its value to make the admin path as secure as you prefer the best.

    Note: I had made the configuration to work on both locally and remotely, perfectly. :smile:

    That's all I had done @enoren5 brother,

    Best Regards, Umar Ahmed

    opened by UmarGit 11
  • Updated mistake in configuration

    Updated mistake in configuration

    Mistake in conditioning

    @enoren5 Brother,

    if str(os.getenv('DATABASE_URL')) == None: #BEFORE
    
    if str(os.getenv('DATABASE_URL')) != 'None': #AFTER
    

    I just checking the DATABASE_URL in a wrong way, now if it is 'None' then it will check for local DB otherwise pick up DB from the DATABASE_URL string.

    Sorry that was my mistake, for bad conditioning it Best Regard Umar Ahmed

    opened by UmarGit 9
  • Update static files

    Update static files

    Static Files Issue

    I have read the official Django's documentation, So, I removed staticfiles folder, So by running python manage.py collectstatic --noinput --clear --no-post-process, we can revive the folder and files on production. Just we must not add static files folder to .gitignore to be read by Heroku in production.

    that's all I had done, @enoren5 brother ❤️

    opened by UmarGit 8
  • Created a mechanism for dynamic user handling

    Created a mechanism for dynamic user handling

    • [x] #60 Created a mechanism for dynamic user handling

    Instead of creating a fake user from setting.py ( which is hardcoded ) and we need a dynamic mechanism to create users with a random name and password. So, I created some methods that create a random user, If it does not exist in the current session of the browser.

    Changed the URL pattern for accessing the portal.

    Updated views.py to check for the user in the current session and also updated the Auth toggle functionality to kick all users at once.

    Lastly updated middleware redirections.

    That's all, I had done, thank you @enoren5

    Best Regards, Umar Ahmed

    opened by UmarGit 8
  • Admin Dashboard banner (at login and after login) which indicates which PostgreSQL DB is active on Heroku

    Admin Dashboard banner (at login and after login) which indicates which PostgreSQL DB is active on Heroku

    Admin Dashboard banner (at login and after login) which indicates which PostgreSQL DB is active on Heroku. Check out: $ heroku pg:info --app tarot-prod (copied below).

    The Django Admin Dashboard sign on page (as well as after having successfully logged in) needs a banner to notify/indicate the user which DATABASE_URL is in use, as well as the Add-on name.

    For example, if HEROKU_POSTGRESQL_NAVY_URL/ postgresql-real-1 is promoted as active and in use, then Admin Dashboard needs to say that in the form of a banner

    Here are all the PostgreSQL DB's currently available for my project:

    $ heroku pg:info --app tarot-prod
    === DATABASE_URL, HEROKU_POSTGRESQL_SILVER_URL
    Plan:                  Hobby-dev
    Status:                Available
    Connections:           0/20
    PG Version:            12.7
    Created:               2020-11-19 10:32 UTC
    Data Size:             8.2 MB
    Tables:                0
    Rows:                  0/10000 (In compliance)
    Fork/Follow:           Unsupported
    Rollback:              Unsupported
    Continuous Protection: Off
    Add-on:                postgresql-lorem-1
    
    === HEROKU_POSTGRESQL_NAVY_URL
    Plan:                  Hobby-dev
    Status:                Available
    Connections:           2/20
    PG Version:            12.7
    Created:               2021-01-09 20:43 UTC
    Data Size:             9.5 MB
    Tables:                21
    Rows:                  113/10000 (In compliance)
    Fork/Follow:           Unsupported
    Rollback:              Unsupported
    Continuous Protection: Off
    Add-on:                postgresql-real-1
    
    === HEROKU_POSTGRESQL_PUCE_URL
    Plan:                  Hobby-dev
    Status:                Available
    Connections:           0/20
    PG Version:            13.3
    Created:               2021-03-20 17:37 UTC
    Data Size:             8.2 MB
    Tables:                0
    Rows:                  0/10000 (In compliance)
    Fork/Follow:           Unsupported
    Rollback:              Unsupported
    Continuous Protection: Off
    Add-on:                postgresql-animate-93816
    
    enhancement 
    opened by enoren5 7
  • More on handling Postgres environmental variables in settings.py

    More on handling Postgres environmental variables in settings.py

    There are two environment issues that need to be fixed.

    Issue 1.

    Here is the DATABASES environment variable inside my settings.py (lines 92-108):

    SELECTED_DB = ""
    
    VALUE = os.getenv('SELECT_DB')
    
    if VALUE == "0":
       SELECTED_DB = "HEROKU_POSTGRESQL_SILVER_URL"
    elif VALUE == "1":
       SELECTED_DB = "HEROKU_POSTGRESQL_NAVY_URL"
    
    DATABASES = {
       'default': dj_database_url.config(
           env=SELECTED_DB,
           default='sqlite:///'+os.path.join(BASE_DIR, 'db.sqlite3'),
           conn_max_age=600)
       }
    
    print(DATABASES)
    

    'SELECT_DB' is an environmental variable (dictionary) declared inside Heroku’s dashboard which is paired with the value specified as an integer, either 1 or 0. On the next line, if the VALUE is 0, then dj_database_url.configures the db to be HEROKU_POSTGRESQL_SILVER_URL. If the value is 1, then dj_database_url.configures the db to be, HEROKU_POSTGRESQL_NAVY_URL. These are references to Postgres URIs which are also formed as configuration variables showing inside the Heroku dashboard. The first “SILVER” db contains Lorem Ipsum placeholder content and the second “NAVY” db contains meaningful blog content posted by the end user. This is my general understanding of what is going on here.

    The problem with all of the above is that Heroku Postgres supports flexible and dynamic on-the-fly provisioning for creating, spinning up, spinning down, swapping around different apps, backing up, and restoring db silos. As you can read at that heading in the Heroku guide it says that to initialize (create) a fresh db, in the Heroku shell, you run: (local venv) $ heroku addons:create heroku-postgresql:hobby-dev

    To view my current Postgres db addon composition and structure, you can use this command:

    (local venv)  $ heroku pg:info
     ›   Warning: heroku update available from 7.47.11 to 7.47.12.
    === HEROKU_POSTGRESQL_NAVY_URL, DATABASE_URL
    Plan:                  Hobby-dev
    Status:                Available
    Connections:           0/20
    PG Version:            12.5
    Created:               2021-01-09 20:43 UTC
    Data Size:             10.0 MB
    Tables:                21
    Rows:                  110/10000 (In compliance)
    Fork/Follow:           Unsupported
    Rollback:              Unsupported
    Continuous Protection: Off
    Add-on:                postgresql-real-1
    
    === HEROKU_POSTGRESQL_ROSE_URL
    Plan:                  Hobby-dev
    Status:                Available
    Connections:           0/20
    PG Version:            13.2
    Created:               2021-02-26 17:21 UTC
    Data Size:             7.9 MB
    Tables:                0
    Rows:                  0/10000 (In compliance) - refreshing
    Fork/Follow:           Unsupported
    Rollback:              Unsupported
    Continuous Protection: Off
    Add-on:                postgresql-adjacent-58092
    
    === HEROKU_POSTGRESQL_SILVER_URL
    Plan:                  Hobby-dev
    Status:                Available
    Connections:           0/20
    PG Version:            12.6
    Created:               2020-11-19 10:32 UTC
    Data Size:             9.6 MB
    Tables:                21
    Rows:                  84/10000 (In compliance)
    Fork/Follow:           Unsupported
    Rollback:              Unsupported
    Continuous Protection: Off
    Add-on:                postgresql-lorem-1
    

    To designate a primary database, you can use this command:

    (local venv) $ heroku pg:promote HEROKU_POSTGRESQL_SILVER_URL (or whichever other db name is available as it appears in the list above). Here in the command line is where I should swap out / switch between databases and not statically coded inside settings.py (like it currently is in my first snippet above).

    With the newly created ROSE db instance, the settings.py is out of date. I would need to add another elif condition which specifies a SELECTED_DB (as described above) as "HEROKU_POSTGRESQL_ROSE_URL" with a value of 2, and then add that config variables inside the Heroku dashboard manually. That’s not ideal, right? The db environmental variable should allow the Heroku sysadmin to change between db’s using the (local venv) $ heroku pg:promote <db name>

    Issue 2:

    I should be able to import (access) remote aws Postgres db’s locally by specifying the remote URL in settings.py in this format: postgres://USER:PASSWORD@HOST:PORT/NAME. This feature is described in John Elder’s Udemy course specified here.

    This feature was actually already implemented in PR #79 but was lost and removed in subsequent PR’s (#80. #81, #82). This needs to be re-implemented. I tried implementing it myself just now by removing the VALUE/SELECTED switches and replacing them with this:

    DATABASE_URL = "" # since this is the default handle as you can see above in the output for the command: $ heroku pg:info
    
    DATABASES = {
       'default': dj_database_url.config(
           env=DATABASE_URL,
           default='sqlite:///'+os.path.join(BASE_DIR, 'db.sqlite3'),
           conn_max_age=600)
       }
    

    But this throws an OperationalError.

    To summarize, here is the takeaway:

    The DATABASES environmental variable needs to be reconfigured inside settings.py to essentially enable: 1. the Heroku sysadmin to swap db’s using the $ heroku pg:promote command rather than updating settings.py every time a new db is spinned up/down. 2. the web developer to reference the remote db locally

    bug enhancement 
    opened by enoren5 7
  • **OperationalError at /at_random:** no such table: generators_generator

    **OperationalError at /at_random:** no such table: generators_generator

    Using the tarot at random button raises the following error:

    Environment: Request Method: GET Request URL: http://localhost:8000/at_random

    Django Version: 2.2.9 Python Version: 3.5.2 Installed Applications: ['essays.apps.EssaysConfig', 'landings.apps.LandingsConfig', 'generators.apps.GeneratorsConfig', 'work_orders.apps.WorkOrdersConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles'] Installed 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']

    Template error: In template /home/sanip/Development/tarot_juicer/templates/base.html, error at line 0 no such table: generators_generator 1 : {% load static %} 2 : 3 : 4 : 5 : 6 : 7 : 8 : 9 : 10 :

    Traceback:

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/db/backends/utils.py" in _execute 84. return self.cursor.execute(sql, params)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py" in execute 383. return Database.Cursor.execute(self, query, params)

    The above exception (no such table: generators_generator) was the direct cause of the following exception:

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner 34. response = get_response(request)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response 115. response = self.process_exception_by_middleware(e, request)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response 113. response = wrapped_callback(request, *callback_args, **callback_kwargs)

    File "/home/sanip/Development/tarot_juicer/generators/views.py" in at_random 13. return render(request, 'generators/at_random.html', context)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/shortcuts.py" in render 36. content = loader.render_to_string(template_name, context, request, using=using)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/template/loader.py" in render_to_string 62. return template.render(context, request)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/template/backends/django.py" in render 61. return self.template.render(context)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/template/base.py" in render 171. return self._render(context)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/template/base.py" in _render 163. return self.nodelist.render(context)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/template/base.py" in render 937. bit = node.render_annotated(context)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/template/base.py" in render_annotated 904. return self.render(context)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/template/loader_tags.py" in render 150. return compiled_parent._render(context)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/template/base.py" in _render 163. return self.nodelist.render(context)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/template/base.py" in render 937. bit = node.render_annotated(context)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/template/base.py" in render_annotated 904. return self.render(context)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/template/loader_tags.py" in render 62. result = block.nodelist.render(context)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/template/base.py" in render 937. bit = node.render_annotated(context)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/template/base.py" in render_annotated 904. return self.render(context)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/template/defaulttags.py" in render 308. if match:

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/db/models/query.py" in bool 278. self._fetch_all()

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/db/models/query.py" in _fetch_all 1242. self._result_cache = list(self._iterable_class(self))

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/db/models/query.py" in iter 55. results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/db/models/sql/compiler.py" in execute_sql 1133. cursor.execute(sql, params)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/db/backends/utils.py" in execute 99. return super().execute(sql, params)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/db/backends/utils.py" in execute 67. return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/db/backends/utils.py" in _execute_with_wrappers 76. return executor(sql, params, many, context)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/db/backends/utils.py" in _execute 84. return self.cursor.execute(sql, params)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/db/utils.py" in exit 89. raise dj_exc_value.with_traceback(traceback) from exc_value

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/db/backends/utils.py" in _execute 84. return self.cursor.execute(sql, params)

    File "/home/sanip/.virtualenvs/tarot/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py" in execute 383. return Database.Cursor.execute(self, query, params)

    Exception Type: OperationalError at /at_random Exception Value: no such table: generators_generator

    opened by SanipRijal 7
  • Outstanding Issue from PR #222

    Outstanding Issue from PR #222

    When I first pulled changes from PR #222 to test, I kept encountering a 404 saying that the page doesn't exist. It took me thirty minutes to realize that the default Bool value for the new is_published attributes were set to False. So I located every is_published class attribute and switched the BooleanFields defaults to True. That's how it should be. I also noticed that you appended the is_published attributes to the very bottom of the model class definitions. As a result, the switch on the Admin Dashboard is all the way at the bottom which makes it hard to locate and easy to overlook. So I moved the is_published attributes closer to the top.

    After making the migrations and then migrating the local db.sqlite3, everything seems to work now. Thank you.

    Although I noticed after merging the changes into master and pushing the changes to my staging/testing pipeline on Heroku, my app is throwing "ProgrammingErrors" and "django.db.utils.OperationalErrors".

    See here:

    Screenshot from 2022-11-08 01-53-21

    Any idea what may be causing this? I Googled around and the many recurring themes in upvoted Stack Overflow answers suggest that the database needs to be migrated. But the automated Heroku Django buildback does this when deployed. It's part of the built-in routine. I tried logging in using Heroku CLI in my shell and ran makemigrations for the primary generators app. Below you can see was the output of me trying to manually migrate the remote Heroku db. Notice that it often refers to db.qlite3. That is odd because remotely Heroku should be using PostreSQL. Any idea what might be happening here?

    (heroku remote environment) ~ $ python manage.py makemigrations generators
    
    Secure Mode Disabled: DEBUG MODE IS TRUE
    
    
    Database Config: {'default': {'NAME': '/app/db.sqlite3', 'USER': '', 'PASSWORD': '', 'HOST': '', 'PORT': '', 'CONN_MAX_AGE': 600, 'ENGINE': 'django.db.backends.sqlite3'}}
    
    Traceback (most recent call last):
      File "/app/.heroku/python/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute
        return self.cursor.execute(sql, params)
      File "/app/.heroku/python/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 423, in execute
        return Database.Cursor.execute(self, query, params)
    sqlite3.OperationalError: no such table: accounts_authtoggle
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/app/manage.py", line 21, in <module>
        main()
      File "/app/manage.py", line 17, in main
        execute_from_command_line(sys.argv)
      File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
        utility.execute()
      File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/__init__.py", line 413, in execute
        self.fetch_command(subcommand).run_from_argv(self.argv)
      File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/base.py", line 354, in run_from_argv
        self.execute(*args, **cmd_options)
      File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/base.py", line 393, in execute
        self.check()
      File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/base.py", line 419, in check
        all_issues = checks.run_checks(
      File "/app/.heroku/python/lib/python3.10/site-packages/django/core/checks/registry.py", line 76, in run_checks
        new_errors = check(app_configs=app_configs, databases=databases)
      File "/app/.heroku/python/lib/python3.10/site-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique
        all_namespaces = _load_all_namespaces(resolver)
      File "/app/.heroku/python/lib/python3.10/site-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
        url_patterns = getattr(resolver, 'url_patterns', [])
      File "/app/.heroku/python/lib/python3.10/site-packages/django/utils/functional.py", line 48, in __get__
        res = instance.__dict__[self.name] = self.func(instance)
      File "/app/.heroku/python/lib/python3.10/site-packages/django/urls/resolvers.py", line 602, in url_patterns
        patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
      File "/app/.heroku/python/lib/python3.10/site-packages/django/utils/functional.py", line 48, in __get__
        res = instance.__dict__[self.name] = self.func(instance)
      File "/app/.heroku/python/lib/python3.10/site-packages/django/urls/resolvers.py", line 595, in urlconf_module
        return import_module(self.urlconf_name)
      File "/app/.heroku/python/lib/python3.10/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
      File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "/app/tarot_juicer/urls.py", line 12, in <module>
        path('', include('accounts.urls')),
      File "/app/.heroku/python/lib/python3.10/site-packages/django/urls/conf.py", line 34, in include
        urlconf_module = import_module(urlconf_module)
      File "/app/.heroku/python/lib/python3.10/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
      File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "/app/accounts/urls.py", line 2, in <module>
        from . import views  # , include
      File "/app/accounts/views.py", line 14, in <module>
        SESSION_TIMEOUT = AuthToggle.objects.first()
      File "/app/.heroku/python/lib/python3.10/site-packages/django/db/models/manager.py", line 85, in manager_method
        return getattr(self.get_queryset(), name)(*args, **kwargs)
      File "/app/.heroku/python/lib/python3.10/site-packages/django/db/models/query.py", line 674, in first
        for obj in (self if self.ordered else self.order_by('pk'))[:1]:
      File "/app/.heroku/python/lib/python3.10/site-packages/django/db/models/query.py", line 280, in __iter__
        self._fetch_all()
      File "/app/.heroku/python/lib/python3.10/site-packages/django/db/models/query.py", line 1324, in _fetch_all
        self._result_cache = list(self._iterable_class(self))
      File "/app/.heroku/python/lib/python3.10/site-packages/django/db/models/query.py", line 51, in __iter__
        results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
      File "/app/.heroku/python/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql
        cursor.execute(sql, params)
      File "/app/.heroku/python/lib/python3.10/site-packages/django/db/backends/utils.py", line 98, in execute
        return super().execute(sql, params)
      File "/app/.heroku/python/lib/python3.10/site-packages/django/db/backends/utils.py", line 66, in execute
        return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
      File "/app/.heroku/python/lib/python3.10/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
        return executor(sql, params, many, context)
      File "/app/.heroku/python/lib/python3.10/site-packages/django/db/backends/utils.py", line 79, in _execute
        with self.db.wrap_database_errors:
      File "/app/.heroku/python/lib/python3.10/site-packages/django/db/utils.py", line 90, in __exit__
        raise dj_exc_value.with_traceback(traceback) from exc_value
      File "/app/.heroku/python/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute
        return self.cursor.execute(sql, params)
      File "/app/.heroku/python/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 423, in execute
        return Database.Cursor.execute(self, query, params)
    django.db.utils.OperationalError: no such table: accounts_authtoggle
    
    opened by enoren5 6
  • Cookie consent pop-up necessary? If so, implement accordingly

    Cookie consent pop-up necessary? If so, implement accordingly

    Does my project use cookies? If cookies are in use, then this package needs to be installed and deployed. If cookies are not implemented, does this mean that the GDPR and the ePrivacy Directive doesn't apply to my website and no cookie consent pop-up is requried?

    documentation enhancement 
    opened by enoren5 0
  • Correct `gateway.html` template syntax error in local dev server environment with DEBUG set to False

    Correct `gateway.html` template syntax error in local dev server environment with DEBUG set to False

    In the local dev server environment, when you:

    1. exit the server
    2. export the DEBUG option to ‘False’, with: $ export DEBUG='False' in your shell
    3. re-run the server with $ python manage.py runserver_plus --cert-file cert.pem --key-file key.pem
    4. navigate to the home landing page...

    ...It throws this Template Syntax Error:

    problem with static files and gateway page - 404 -Screenshot_2022-04-16_10-29-04

    I’ve taken a close look at the gateway.html template carefully, paying close attention to the way static files are imported with Jinja syntax. Everything looks OK to me. Not sure what the issue is here. This needs to be fixed.

    I also noticed that when I re-export the DEBUG option to True, the error goes away. So to resolve this issue, the DEBUG namespace variable needs to be exported when set to False.

    bug 
    opened by enoren5 0
Owner
Kyle Rafa Lazaro
coffee
Kyle Rafa Lazaro
CMS framework for Django

Created by Stephen McDonald Overview Mezzanine is a powerful, consistent, and flexible content management platform. Built using the Django framework,

Stephen McDonald 4.6k Dec 29, 2022
Ella is a CMS based on Python web framework Django with a main focus on high-traffic news websites and Internet magazines.

Ella CMS Ella is opensource CMS based on Django framework, designed for flexibility. It is composed from several modules: Ella core is the main module

null 295 Oct 16, 2022
An open source CMS, in python and integrable in Django

Python CMS based on the Django Framework

Titouan Bénard 0 Sep 10, 2021
Django CMS Project for quicksetup with minimal installation process.

Django CMS Project for quicksetup with minimal installation process.

Dipankar Chowdhury 3 Mar 24, 2022
Kotti is a high-level, Pythonic web application framework based on Pyramid and SQLAlchemy. It includes an extensible Content Management System called the Kotti CMS.

Kotti Kotti is a high-level, Pythonic web application framework based on Pyramid and SQLAlchemy. It includes an extensible Content Management System c

Kotti 394 Jan 7, 2023
The easy-to-use and developer-friendly CMS

django CMS Open source enterprise content management system based on the Django framework and backed by the non-profit django CMS Association. Get inv

django CMS Association 9.1k Jan 4, 2023
The easy-to-use and developer-friendly CMS

django CMS Open source enterprise content management system based on the Django framework and backed by the non-profit django CMS Association. Get inv

django CMS Association 9.1k Jan 8, 2023
The Plone CMS: root integration package

About Plone Plone is a mature, secure and user-friendly Content Management System (CMS). Plone - and the Open Source community behind it - aggregates

Plone Foundation 200 Jan 8, 2023
A python open source CMS scanner that automates the process of detecting security flaws of the most popular CMSs

CMSmap CMSmap is a python open source CMS scanner that automates the process of detecting security flaws of the most popular CMSs. The main purpose of

RazzorBack 1 Oct 31, 2021
A plugin for Wagtail CMS, to have Icon Blocks (Fontawesome support)

WAGTAIL ICONIFY Library developed for Wagtail CMS, its purpose is to provide icon blocks from various libraries Special thanks to Alex Gleason, as wel

null 2 Jun 7, 2022
A Django content management system focused on flexibility and user experience

Wagtail is an open source content management system built on Django, with a strong community and commercial support. It's focused on user experience,

Wagtail 13.8k Jan 1, 2023
A modular, high performance, headless e-commerce platform built with Python, GraphQL, Django, and ReactJS.

Saleor Commerce Customer-centric e-commerce on a modern stack A headless, GraphQL-first e-commerce platform delivering ultra-fast, dynamic, personaliz

Mirumee Labs 17.8k Jan 7, 2023
A Django blog app implemented in Wagtail

Puput Puput is a powerful and simple Django app to manage a blog. It uses the awesome Wagtail CMS as content management system. Puput is the catalan n

APSL 535 Jan 8, 2023
Simple yet powerful and really extendable application for managing a blog within your Django Web site.

Django Blog Zinnia Simple yet powerful and really extendable application for managing a blog within your Django Web site. Zinnia has been made for pub

Julien Fache 2.1k Dec 24, 2022
django blog - complete customization and ready to use with one click installer

django-blog-it Simple blog package developed with Django. Features: Dynamic blog articles Blog pages Contact us page (configurable) google analytics S

MicroPyramid 220 Sep 18, 2022
Open Source CRM based on Django

Django-CRM Django CRM is opensource CRM developed on django framework. It has all the basic features of CRM to start with. We welcome code contributio

MicroPyramid 1.4k Dec 31, 2022
A full stack e-learning application, this is the backend using django restframework and docker.

DevsPrime API API Service backing client interfaces Technologies Python 3.9 : Base programming language for development Bash Scripting : Create conven

Nnabue Favour Chukwuemeka 1 Oct 21, 2021
An encylopedia that runs on Django as part of CS50w's coursework

Django Wiki As part of the CS50w course, this project aims to apply the use of Django together with HTML and CSS to replicate an encyclopedia. Require

Beckham 1 Oct 28, 2021
Django e-commerce website with Advanced Features and SEO Friendly

MyTech® - Your Technology Django e-commerce website with Advanced Features and SEO Friendly Images and Prices are only used for Demo purpose and does

null 28 Dec 21, 2022